Changes between Version 7 and Version 8 of ClassBasedViews
- Timestamp:
- Oct 2, 2010, 7:04:30 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ClassBasedViews
v7 v8 39 39 * Avoids messy and non-idiomatic hacks. 40 40 * Avoids copying or creating new view instance on every request. 41 * All the options for actually protecting against thread-unsafety involve some kind of "surprising" behavior. The surprising behavior here (can't store state on self) is explicit and fails immediately, rather than failing mysteriously and only under concurrency.41 * All the options for actually protecting against thread-unsafety involve some kind of "surprising" behavior. The surprising behavior here (can't store state on self) is explicit and fails immediately, rather than failing confusingly and only under certain circumstances. 42 42 43 43 Arguments against: … … 66 66 Arguments against: 67 67 * The "copy on !__call!__()" approach is a little messy. Normal Python idiom wouldn't lead users to expect that !__call!__() would cause a copy to be created. 68 * The abstraction of the copy-on-call can leak in surprising ways. Some users will try to set up state using an !__init!__ method (common practice). If any of the state they attach to self in !__init!__ is mutable (list, dict, object, etc) and they mutate it in the view, this is once again un-threadsafe (but will appear to work fine locally).68 * The abstraction of the copy-on-call can leak in surprising ways. Some users will try to set up state using an !__init!__ method (common practice). If any of the state they attach to self in !__init!__ is mutable (list, dict, object, etc) and they mutate it in the view, this will fail (but not immediately, or in obvious ways). 69 69 70 70 ==== !__new!__() ====