#13842: XViewMiddleware fails with class-based views
----------------------------+-----------------------------------------------
 Reporter:  ch0wn           |       Owner:  nobody    
   Status:  new             |   Milestone:            
Component:  Core framework  |     Version:  SVN       
 Keywords:  middleware      |       Stage:  Unreviewed
Has_patch:  0               |  
----------------------------+-----------------------------------------------
 When doing a HEAD request on a class-based view, while having
 XViewMiddleware enabled, an error occures when accessing
 {{{view_func.__name__}}}, as an instance does not provide a {{{__name__}}}
 attribute.

 == Example ==

 views.py
 {{{
 #!python

 # mapped to /1
 def simple_function(request):
     return HttpResponse("Hello World")


 # mapped to /2
 class SimpleClass(object):
     def __call__(self, request):
         return HttpResponse("Hello World")
 }}}

 {{{
 » curl -I http://localhost:8000/1
 HTTP/1.0 200 OK
 Date: Sun, 27 Jun 2010 20:10:25 GMT
 Server: WSGIServer/0.1 Python/2.6.5
 X-View: djangoheadfix.views.simple_function
 Content-Type: text/html; charset=utf-8

 » curl -I http://localhost:8000/2
 HTTP/1.0 500 INTERNAL SERVER ERROR
 Date: Sun, 27 Jun 2010 20:10:56 GMT
 Server: WSGIServer/0.1 Python/2.6.5
 Content-Type: text/html
 }}}

 I'm going to attach a patch for this.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13842>
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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to