î
ªÍ XC  ã               @   sJ   d  d l  m Z d  d l m Z d  d l m Z Gd d „  d e ƒ Z d S)é    )Úhttp)Úsettings)ÚMiddlewareMixinc               @   s"   e  Z d  Z d Z d d „  Z d S)ÚXViewMiddlewarez^
    Adds an X-View header to internal HEAD requests -- used by the documentation system.
    c             C   s¤   t  | d ƒ s4 t d t j d k r* d n d ƒ ‚ | j d k r  | j j d ƒ t j k sv | j j	 r  | j j
 r  t j ƒ  } d | j | j f | d	 <| Sd S)
a)  
        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.
        Úuserz¬The XView middleware requires authentication middleware to be installed. Edit your MIDDLEWARE%s setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware'.NZ_CLASSESÚ ÚHEADZREMOTE_ADDRz%s.%szX-View)ÚhasattrÚAssertionErrorr   Z
MIDDLEWAREÚmethodZMETAÚgetZINTERNAL_IPSr   Z	is_activeZis_staffr   ZHttpResponseÚ
__module__Ú__name__)ÚselfÚrequestZ	view_funcZ	view_argsZview_kwargsÚresponse© r   úQ/home/ubuntu/projects/ifolica/build/django/django/contrib/admindocs/middleware.pyÚprocess_view
   s    *zXViewMiddleware.process_viewN)r   r   Ú__qualname__Ú__doc__r   r   r   r   r   r      s   r   N)Zdjangor   Zdjango.confr   Zdjango.utils.deprecationr   r   r   r   r   r   Ú<module>   s   