I don't think there's an issue with my syntax (unless I've made a typo here) because I have many other decorators which were created in the same way.
How do you create one with the decorator package? On Oct 6, 6:22 pm, Wyatt Baldwin <[email protected]> wrote: > On Oct 6, 8:42 am, Matt H <[email protected]> wrote: > > > Hi. > > > I'm trying to set an attribute on c from a decorator, like so: > > > def dec1(): > > def wrap_fn(f): > > c.msg = 'hi' > > return f > > return wrap_fn > > > @dec1 > > def create(self): > > return render('create_tmpl') > > Doesn't `dec1` need to take `f` as an arg? I.e.: > > def dec1(f): ... > > Either that or you need to call `dec1` where you use it as a > decorator: > > @dec1() > > Also, don't you need to *call* `f` (and return the result) in > `wrap_fn`? > > I tend to use the decorator package for creating decorators; I think > it's simpler. -- 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.
