summaryrefslogtreecommitdiff
path: root/decorator/documentation.py
diff options
context:
space:
mode:
Diffstat (limited to 'decorator/documentation.py')
-rw-r--r--decorator/documentation.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/decorator/documentation.py b/decorator/documentation.py
index 80a3161..9e58751 100644
--- a/decorator/documentation.py
+++ b/decorator/documentation.py
@@ -353,8 +353,6 @@ three callbacks ``on_success``, ``on_failure`` and ``on_closing``,
to specify how to manage the function call.
The implementation is the following:
-.. code-block:: python
-
$$on_success
$$on_failure
$$on_closing
@@ -506,14 +504,14 @@ $$identity_dec
(see bug report 1764286_ for an explanation of what is happening).
Unfortunately the bug is still there, even in Python 2.7 and 3.1.
There is however a workaround. The decorator module adds an
-attribute ``.undecorated`` to the decorated function, containing
+attribute ``.__wrapped__`` to the decorated function, containing
a reference to the original function. The easy way to get
the source code is to call ``inspect.getsource`` on the
undecorated function:
.. code-block:: python
- >>> print inspect.getsource(factorial.undecorated)
+ >>> print inspect.getsource(factorial.__wrapped__)
@tail_recursive
def factorial(n, acc=1):
"The good old factorial"
@@ -535,7 +533,7 @@ having to rewrite them in terms of ``decorator``. You can use a
$$decorator_apply
-``decorator_apply`` sets the attribute ``.undecorated`` of the generated
+``decorator_apply`` sets the attribute ``.__wrapped__`` of the generated
function to the original function, so that you can get the right
source code.
@@ -834,7 +832,7 @@ def decorator_apply(dec, func):
"""
return FunctionMaker.create(
func, 'return decorated(%(signature)s)',
- dict(decorated=dec(func)), undecorated=func)
+ dict(decorated=dec(func)), __wrapped__=func)
def _trace(f, *args, **kw):
print "calling %s with args %s, %s" % (f.__name__, args, kw)