store decorated function in easy to navigate attribute for IPython/ipdb debugging

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45078 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 21602937
...@@ -79,11 +79,13 @@ def simple_decorator(decorator): ...@@ -79,11 +79,13 @@ def simple_decorator(decorator):
g.__name__ = f.__name__ g.__name__ = f.__name__
g.__doc__ = f.__doc__ g.__doc__ = f.__doc__
g.__dict__.update(f.__dict__) g.__dict__.update(f.__dict__)
g._original = f # for tab_completion navigation in IPython
return g return g
# Now a few lines needed to make simple_decorator itself # Now a few lines needed to make simple_decorator itself
# be a well-behaved decorator. # be a well-behaved decorator.
new_decorator.__name__ = decorator.__name__ new_decorator.__name__ = decorator.__name__
new_decorator.__doc__ = decorator.__doc__ new_decorator.__doc__ = decorator.__doc__
new_decorator._original = decorator # for tab_completion navigation in IPython
new_decorator.__dict__.update(decorator.__dict__) new_decorator.__dict__.update(decorator.__dict__)
return new_decorator return new_decorator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment