On Fri, May 30, 2008 at 9:59 AM, Karlo Lozovina
<[EMAIL PROTECTED]> wrote:
>
> Here is the problematic code, decoraor first (it doesn't do very
> much :>):
>
> def debugprint(f):
>    def new(*args):
>        return f(*args)
>    return new
>
> And the controller:
>
> @debugprint
> def testing(self, xx):
>    return "Testing-testing"
>
> Route that connects the URL with the controller looks like this:
>
> map.connect('test-test', '/test/:xx', controller='chat',
> action='testing')
>
> When accessing http://somesite.com/test/1 I get this error:
>
> TypeError: testing() takes exactly 2 arguments (1 given)
>
> Any ides why this is happening?

Its because your changing the function signature. You can mess around
to fix this your self or just the decorator module like this:

from decorator import decorator
@decorator
def debugprint(f, *args, **kwargs):
    print "debug stuff"
    f(*args, **kwargs)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to