#19005: Allow class based views to be included in urls.py by name as a string
-----------------------------+--------------------------------------
     Reporter:  tanderegg    |                    Owner:  nobody
         Type:  New feature  |                   Status:  new
    Component:  Core (URLs)  |                  Version:  master
     Severity:  Normal       |               Resolution:
     Keywords:  cbv          |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------

Comment (by aaugustin):

 Importing views by name in URLconfs has a big drawback: import errors are
 delayed until runtime. Resulting tracebacks can be confusing. I'd prefer
 to move away from identifying views by name. Hence I'm -0 on this
 proposal.

 ----

 I also have a backwards compatibility nitpick. Technically, a view can be
 any callable, including a class. The following class is a valid Django
 view:

 {{{
 from django.http import HttpResponse

 class HelloWorld(HttpResponse):
     def __init__(self, request):
         return super(HelloWorld, self).__init__('hello world',
 content_type='text/plain')
 }}}

 I don't know if this pattern is common or even useful, but it's something
 that currently works, and your proposal would break it.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19005#comment:2>
Django <https://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 https://groups.google.com/groups/opt_out.


Reply via email to