On Sat, Jun 27, 2009 at 01:17:42PM +0530, Kenneth Gonsalves wrote: > decorator--------------------------- > > class menu_enabled(object): > def __init__(self,menuname): > self.menuname = menuname > > def __call__(self,f): > def wrapper(*args,**kwargs): > try: > mn = Menuitem.objects.get(name__iexact = self.menuname) > f(*args,**kwargs) > except: > msg = _("You are already registered") > return HttpResponseRedirect("/2009/message/%s/" % msg) > > return wrapper > ------end of decorator > > obviously this f(*args,**kwargs) is not the correct way to call the view. Any > clues?
I have never written a decorator, so I may be completely off here, however shouldn't that be "return f(*args,**kwargs)"? ie. don't you need to return the value? -- Brian May <br...@microcomaustralia.com.au> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---