
    h1                     V    S SK Jr  S SKJr  S SKJr  S SKJr  SSKJ	r	   " S S\5      r
g	)
    )settings)ImproperlyConfigured)HttpResponse)MiddlewareMixin   )get_view_namec                       \ rS rSrSrS rSrg)XViewMiddleware	   z1
Add an X-View header to internal HEAD requests.
c                 n   [        US5      (       d  [        S5      eUR                  S:X  a  UR                  R	                  S5      [
        R                  ;   d6  UR                  R                  (       a@  UR                  R                  (       a$  [        5       n[        U5      UR                  S'   U$ ggg)z
If the request method is HEAD and either the IP is internal or the
user is a logged-in staff member, return a response with an x-view
header indicating the view function. This is used to lookup the view
function for an arbitrary page.
userzThe XView middleware requires authentication middleware to be installed. Edit your MIDDLEWARE setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware'.HEADREMOTE_ADDRzX-ViewN)hasattrr   methodMETAgetr   INTERNAL_IPSr   	is_activeis_staffr   r   headers)selfrequest	view_func	view_argsview_kwargsresponses         U/var/www/html/env/lib/python3.13/site-packages/django/contrib/admindocs/middleware.pyprocess_viewXViewMiddleware.process_view   s     w''&M 
 >>V#LL]+x/D/DD&&7<<+@+@#~H)6y)AHX&O	 ,A& $     N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r"   r!   r   r
   r
   	   s    r!   r
   N)django.confr   django.core.exceptionsr   django.httpr   django.utils.deprecationr   utilsr   r
   r"   r!   r   <module>r.      s       7 $ 4  o r!   