Changes between Version 8 and Version 9 of ClassBasedViews
- Timestamp:
- Oct 2, 2010, 12:54:45 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ClassBasedViews
v8 v9 32 32 Pass around the request object via method arguments, store arbitrary state on the request or a special "state" object or dict that is passed around or attached to the request. 33 33 34 Document that state should be stored on the request, storing it on the view instance is unsafe. Additionally, override __setattr__ or __setattribute__ to make setting state on self raise an error or warning. 34 Document that state should be stored on the request, storing it on the view instance is unsafe. Additionally, override `__setattr__` to make setting state on self raise an error or warning. 35 36 Alternatively, override `__getattr__/__setattr__` to access `self.request.state` under the hood while on the surface it looks as if the state is stored on the view instance. 35 37 36 38 Example usage and view would be the same as shown below in "__call__ and copy()". … … 42 44 43 45 Arguments against: 44 * It's unusual to have a class where you can't store state on self .46 * It's unusual to have a class where you can't store state on self while in `__init__`. 45 47 46 48 ==== !__call!__() and copy() ====