Turning a signature-changing decorator into a signature-preserving one
Michele Simionato
michele.simionato at gmail.com
Sat Feb 14 09:27:10 EST 2009
On Feb 14, 1:30 pm, Gustavo Narea <m... at gustavonarea.net> wrote:
> This is what I get:
> """
> (Pdb) func.__name__
> 'greetings'
> (Pdb) func.__dict__
> {}
> (Pdb) func.__module__
> 'pylonsproject.controllers.root'
> """
>
> Which seems correct to me.
>
> By the way, I forgot to mention that what is decorated is an instance
> method. I don't know if that would change something.
This is bad, func should be a function and not an instance
method (see line 49 of decorator.py). If the .signature
attribute of the FunctionMaker is missing, than that's the
reason for the AssertionError you see.
I should probably raise a clearer error message.
I lack the context to see how this could be fixed in your case, but
this a not a show stopper, you can just keep the original decorator
and forget about making it signature preserving.
More information about the Python-list
mailing list