Changes between Version 3 and Version 4 of ClassBasedViews


Ignore:
Timestamp:
Oct 1, 2010, 10:32:32 AM (14 years ago)
Author:
Carl Meyer
Comment:

add "store state on request" thread-safety option

Legend:

Unmodified
Added
Removed
Modified
  • ClassBasedViews

    v3 v4  
    2727=== View instantiation and thread safety ===
    2828The [http://groups.google.com/group/django-developers/browse_thread/thread/e23d9a5a58fe5891 most recent django-developers discussion on the topic] discussed many of the available options on instantiating the views and protecting them from threading issues. Here is a summary of the various approaches that have been proposed.
     29
     30==== Store state on request, not view ====
     31
     32Pass around the request object via method arguments, store arbitrary state on the request (perhaps in a blessed dictionary for that, or just in attributes). Document that state should be stored on the request, storing it on the view instance is unsafe, just like is already the case with ModelAdmin subclasses.
     33
     34Example usage and view would be the same as shown below in "__call__ and copy()".
     35
     36Arguments for:
     37 * Avoids messy and non-idiomatic hacks.
     38 * Avoids copying or creating new view instance on every request.
     39
     40Arguments against:
     41 * Leaves some room for people to shoot themselves in the foot.
    2942
    3043==== !__call!__() and copy() ====
Back to Top