Hi,
It is probably something simple, but I'm having some difficulty
writing a decorator factory for a controller method.

# The decorator stuff
def factory(param):
  def deco(func):
    def newaction(self, *args, **kw):
       return func(self, *args, **kw)
    return newaction
  return deco

# The controller method
@factory(param1)
def action(self):
  return 'interesting stuff'

The error I'm getting is:
<type 'exceptions.TypeError'>: action() got an unexpected keyword
argument 'start_response'

I believe this is happening because controller actions can take some
keyword arguments like: start_response, controller, sub_domain,
environ, action, etc
that are somehow implied and only passed in if the method requests
them.  It looks like pylons.controllers.core does the magic of
figuring that out and I'd rather not duplicate that in my
decorators.

Any suggestions on how to correctly write a decorator factory for a
controller method?

Thanks,
Chris

--~--~---------~--~----~------------~-------~--~----~
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