ó
;ÏOc           @   s:   d  d l  m Z d  d l m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   settings(   t   httpt   XViewMiddlewarec           B   s   e  Z d  Z d „  Z RS(   s^   
    Adds an X-View header to internal HEAD requests -- used by the documentation system.
    c         C   s‹   t  | d ƒ s t d ƒ ‚ | j d k r‡ | j j d ƒ t j k s] | j j r‡ | j j	 r‡ t
 j ƒ  } d | j | j f | d <| Sd S(   s)  
        If the request method is HEAD and either the IP is internal or the
        user is a logged-in staff member, quickly return with an x-header
        indicating the view function.  This is used by the documentation module
        to lookup the view function for an arbitrary page.
        t   users²   The XView middleware requires authentication middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware'.t   HEADt   REMOTE_ADDRs   %s.%ss   X-ViewN(   t   hasattrt   AssertionErrort   methodt   METAt   getR    t   INTERNAL_IPSR   t	   is_activet   is_staffR   t   HttpResponset
   __module__t   __name__(   t   selft   requestt	   view_funct	   view_argst   view_kwargst   response(    (    s.   ../Django//lib/python/django/middleware/doc.pyt   process_view   s    	*(   R   R   t   __doc__R   (    (    (    s.   ../Django//lib/python/django/middleware/doc.pyR      s   N(   t   django.confR    t   djangoR   t   objectR   (    (    (    s.   ../Django//lib/python/django/middleware/doc.pyt   <module>   s   