yeah, after asking the question i've read about decorators in tg and
using the __before__ method makes more sense for the whole controller
instead of decorating the controller.

On Aug 4, 4:42 pm, Alessandro Molina <[email protected]>
wrote:
> Uhm,
> I think that the correct method to do something like that is to use
> _before instead of decorating the class itself.
>
>
>
>
>
>
>
> On Thu, Aug 4, 2011 at 1:50 PM, Mengu <[email protected]> wrote:
> > hello everyone,
>
> > i have implemented a decorator in which i do a redirect after some
> > condition checks.
>
> > def my_decorator(func):
> >    def inner(*args, **kwargs):
> >        if condition
> >            redirect(url)
> >        return func(*args, **kwargs)
> >    return inner
>
> > the problem here is.. when i decorate a controller action, there is no
> > problem with the redirect. it is working without any problem. if i
> > want to decorate a controller class, i get the following exception:
> >http://paste.pocoo.org/show/FxZYrmkL3CIkseGsiACq/
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "TurboGears" 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 
> > athttp://groups.google.com/group/turbogears?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to