Show More
@@ -210,11 +210,13 b' def bind(func, *args):' | |||
|
210 | 210 | return func(*(args + a), **kw) |
|
211 | 211 | return closure |
|
212 | 212 | |
|
213 | def _updatewrapper(wrap, origfn): | |
|
214 |
'''Copy attributes to wrapper |
|
|
213 | def _updatewrapper(wrap, origfn, unboundwrapper): | |
|
214 | '''Copy and add some useful attributes to wrapper''' | |
|
215 | 215 | wrap.__module__ = getattr(origfn, '__module__') |
|
216 | 216 | wrap.__doc__ = getattr(origfn, '__doc__') |
|
217 | 217 | wrap.__dict__.update(getattr(origfn, '__dict__', {})) |
|
218 | wrap._origfunc = origfn | |
|
219 | wrap._unboundwrapper = unboundwrapper | |
|
218 | 220 | |
|
219 | 221 | def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): |
|
220 | 222 | '''Wrap the command named `command' in table |
@@ -254,7 +256,7 b' def wrapcommand(table, command, wrapper,' | |||
|
254 | 256 | |
|
255 | 257 | origfn = entry[0] |
|
256 | 258 | wrap = bind(util.checksignature(wrapper), util.checksignature(origfn)) |
|
257 | _updatewrapper(wrap, origfn) | |
|
259 | _updatewrapper(wrap, origfn, wrapper) | |
|
258 | 260 | if docstring is not None: |
|
259 | 261 | wrap.__doc__ += docstring |
|
260 | 262 | |
@@ -303,7 +305,7 b' def wrapfunction(container, funcname, wr' | |||
|
303 | 305 | origfn = getattr(container, funcname) |
|
304 | 306 | assert callable(origfn) |
|
305 | 307 | wrap = bind(wrapper, origfn) |
|
306 | _updatewrapper(wrap, origfn) | |
|
308 | _updatewrapper(wrap, origfn, wrapper) | |
|
307 | 309 | setattr(container, funcname, wrap) |
|
308 | 310 | return origfn |
|
309 | 311 |
General Comments 0
You need to be logged in to leave comments.
Login now