web/lib/django/middleware/doc.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
    10         If the request method is HEAD and either the IP is internal or the
    10         If the request method is HEAD and either the IP is internal or the
    11         user is a logged-in staff member, quickly return with an x-header
    11         user is a logged-in staff member, quickly return with an x-header
    12         indicating the view function.  This is used by the documentation module
    12         indicating the view function.  This is used by the documentation module
    13         to lookup the view function for an arbitrary page.
    13         to lookup the view function for an arbitrary page.
    14         """
    14         """
    15         if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)):
    15         if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or
       
    16                                          (request.user.is_active and request.user.is_staff)):
    16             response = http.HttpResponse()
    17             response = http.HttpResponse()
    17             response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)
    18             response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)
    18             return response
    19             return response