Browse Source

More section - decorator

replaced "wrapped_f" with "wrapper_function" in .py and .txt files (I
thought this would be easier to understand for beginners, but I could be
wrong).
d-s-1 8 years ago
parent
commit
162828bb28
2 changed files with 3 additions and 3 deletions
  1. 2 2
      programs/more_decorator.py
  2. 1 1
      programs/more_decorator.txt

+ 2 - 2
programs/more_decorator.py

@@ -7,7 +7,7 @@ log = logging.getLogger("retry")
 
 def retry(f):
     @wraps(f)
-    def wrapped_f(*args, **kwargs):
+    def wrapper_function(*args, **kwargs):
         MAX_ATTEMPTS = 5
         for attempt in range(1, MAX_ATTEMPTS + 1):
             try:
@@ -21,7 +21,7 @@ def retry(f):
         log.critical("All %s attempts failed : %s",
                      MAX_ATTEMPTS,
                      (args, kwargs))
-    return wrapped_f
+    return wrapper_function
 
 
 counter = 0

+ 1 - 1
programs/more_decorator.txt

@@ -3,7 +3,7 @@ Write to a database or make a network call or etc.
 This will be automatically retried if exception is thrown.
 ERROR:retry:Attempt 1/5 failed : (('Some bad value',), {})
 Traceback (most recent call last):
-  File "more_decorator.py", line 14, in wrapped_f
+  File "more_decorator.py", line 14, in wrapper_function
     return f(*args, **kwargs)
   File "more_decorator.py", line 39, in save_to_database
     raise ValueError(arg)