>
> We document the issue, warn people not to store state on the instance
> itself, but tell them that if they must have stateful data, it should be
> attached to self.state instead of self, and they will be OK.  They might
> still be bitten if they put mutable configuration data into the __init__
> and it gets mutated, but we have made it easy to do the right thing -
> doing 'self.state.x' is only slightly harder than 'self.x'
>
> Thoughts?


I'm not very convinced about this but I'll just throw it out there, how
about keeping the same state object in each request instance (assigned at
the base __call__ implementation) and overriding getattr and setattr to work
with the state object in request (getattr would fallback to regular
attributes set during the constructor when no request was present)? Although
this would require using threadlocals to access the right request object
from getattr and setattr.

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

Reply via email to