I am having problems using decorators with controllers. In a test
controller:
# testcontroller.py
def dec(func):
# do lotsa things
print "im doing something"
finished = True
if finished:
func() # call the function you were decorating
class HomeController(BaseController):
def index(self):
return render_response('index.html')
@dec(home)
def test(self):
return render_response('test.html')
tryinf this, I get an error:
exceptions.TypeError: home() takes exactly 1 argument (0 given)
I have to pass "self" to the function passed to the decorator somehow,
what would be the best way to do this? I want the decorator to carry
out a few things before calling the controller function its
decorating.
thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---