#15303: Functions passed as kwargs to View.as_view() should be bound
---------------------------+------------------------------------------------
 Reporter:  gg             |          Owner:  nobody    
   Status:  new            |      Milestone:  1.3       
Component:  Generic views  |        Version:  SVN       
 Keywords:                 |   Triage Stage:  Unreviewed
Has patch:  0              |  
---------------------------+------------------------------------------------
 Problem:

 At the moment, generic.base.View.as_view() passes kwargs to the class'
 init (which `setattr`s them), rather than dynamically subclassing. The
 [http://docs.djangoproject.com/en/dev//topics/class-based-views/
 introductory generic view docs], however, seem to imply that passing
 kwargs to the as_view() method is equivalent to overriding the class. For
 example, it [http://docs.djangoproject.com/en/dev//topics/class-based-
 views/#simple-usage refers to] "pass[ing] the new attributes into the
 as_view method call" as an "overriding pattern." This makes it rather
 surprising that functions passed to as_view() aren't bound to the
 resultant instance.

 Possible Resolutions:

 It seems to me that as_view() should dynamically create a subclass with
 the provided kwargs. Alternatively, if that is deemed undesirable, the
 docs should at least be clarified to better explain the true behaviour.

 I can provide a patch, but need someone (*cough* RKM :) to confirm the
 desired behaviour.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15303>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

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

Reply via email to