I forgot to mention that this only happens with the attributes set
from the decorator. Setting them from other places, e.g. the
controller method/action, works fine.

On Oct 6, 4:42 pm, Matt H <matt2...@gmail.com> 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')
>
> My template contains ${c.msg}
>
> When the web server restarts to apply to code changes, and I load the
> page up, "hi" is displayed as you would expect. HOWEVER, any
> subsequent requests yield an error. It only works for the first
> request.
>
> AttributeError: 'ContextObj' object has no attribute 'msg'
>
> Any idea on what could be causing this odd behavior?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to