
JKc           @   s:   d  d k  l Z d  d k l 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   su   | i  d j oa | i i d  t i j p | i i o8 | i i o+ t i	   } d | i
 | i f | d <| Sd 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   HEADt   REMOTE_ADDRs   %s.%ss   X-ViewN(   t   methodt   METAt   getR    t   INTERNAL_IPSt   usert	   is_activet   is_staffR   t   HttpResponset
   __module__t   __name__(   t   selft   requestt	   view_funct	   view_argst   view_kwargst   response(    (    s?   /usr/local/lib/python2.6/dist-packages/django/middleware/doc.pyt   process_view   s
    ,(   R   R   t   __doc__R   (    (    (    s?   /usr/local/lib/python2.6/dist-packages/django/middleware/doc.pyR      s   N(   t   django.confR    t   djangoR   t   objectR   (    (    (    s?   /usr/local/lib/python2.6/dist-packages/django/middleware/doc.pyt   <module>   s   