Turning a signature-changing decorator into a signature-preserving one
me at gustavonarea.net
Mon Feb 16 10:59:41 EST 2009
On Feb 16, 4:40 pm, Michele Simionato <michele.simion... at gmail.com>
> > It was broken from the beginning on Pylons.
> > I'm a TurboGears 2 core developer, and TurboGears is powered by Pylons
> > as of version 2. The decorator has always worked in TurboGears because
> > of the way TG finds the action arguments, but now I'm working to make
> > it work in Pylons too, but this is the only problem that has stopped
> > me from making it work under Pylons.
> > Thanks.
> I see. I would ask on the Pylons list. I suspect a bound method is
> passed and that you will
> need to extract the corresponding function with .im_func, then making
> sure that you pass
> the self argument correctly. But this is wild guess since I have no
> idea of how Pylons decorators
> work internally as compared to TurboGears decorators.
I've not seen anything special in Pylons or TurboGears 2 decorators,
except that they are all functions that use the decorator package --
while my decorator is a class that doesn't use the decorator package
My attempt to turn that decorator into a signature preserving one
using the decorator packages fails even on TurboGears 2. As of
decorator 3.0.1, I get this error:
TypeError: You are decorating a non function: <unbound method
Isn't this caused by the fact that my decorator is a class, or the way
such a class is defined (whose code is in the first post of the
thread)? I can turn it into a function because I'm sure I'll work --
although I wanted a class to make it easier to customize.
More information about the Python-list