a
    wh1                     @   sP   d dl mZ d dlmZ d dlmZ d dlmZ ddlm	Z	 G dd deZ
d	S )
    )settings)ImproperlyConfigured)HttpResponse)MiddlewareMixin   )get_view_namec                   @   s   e Zd ZdZdd ZdS )XViewMiddlewarez9
    Add an X-View header to internal HEAD requests.
    c                 C   sZ   t |dstd|jdkrV|jdtjv s>|jjrV|jj	rVt
 }t||jd< |S dS )a  
        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'.HEADZREMOTE_ADDRzX-ViewN)hasattrr   methodZMETAgetr   ZINTERNAL_IPSr	   Z	is_activeZis_staffr   r   headers)selfrequestZ	view_funcZ	view_argsZview_kwargsresponse r   ]/var/www/battlenet.uz/venv/lib/python3.9/site-packages/django/contrib/admindocs/middleware.pyprocess_view   s    

zXViewMiddleware.process_viewN)__name__
__module____qualname____doc__r   r   r   r   r   r   	   s   r   N)Zdjango.confr   Zdjango.core.exceptionsr   Zdjango.httpr   Zdjango.utils.deprecationr   utilsr   r   r   r   r   r   <module>   s
   