Ticket #13842: 0002-XViewMiddleware-with-class-based-views.patch

File 0002-XViewMiddleware-with-class-based-views.patch, 1.1 KB (added by ch0wn, 14 years ago)

I'm not sure know if this is a much better idea, but at least it works correctly.

  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index 9627882..a0cf084 100644
    a b answer newbie questions, and generally made Django that much better:  
    511511    Cheng Zhang
    512512    Glenn Maynard <glenn@zewt.org>
    513513    bthomas
     514    Pascal Hartig <phartig@rdrei.net>
    514515
    515516A big THANK YOU goes to:
    516517
  • django/middleware/doc.py

    diff --git a/django/middleware/doc.py b/django/middleware/doc.py
    index 4f91503..aba61be 100644
    a b class XViewMiddleware(object):  
    1515        if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or
    1616                                         (request.user.is_active and request.user.is_staff)):
    1717            response = http.HttpResponse()
    18             response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)
     18
     19            if hasattr(view_func, 'func_name'):
     20                name = view_func.func_name
     21            else:
     22                name = view_func.__class__.__name__
     23
     24            response['X-View'] = "%s.%s" % (view_func.__module__, name)
    1925            return response
Back to Top