o
    	h1                     @   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   sb   t |ds	td|jdkr+|jdtjv s|jjr-|jj	r/t
 }t||jd< |S dS 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'.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response r   e/var/www/html/optinet_system/venv/lib/python3.10/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)django.confr   django.core.exceptionsr   django.httpr   django.utils.deprecationr   utilsr   r   r   r   r   r   <module>   s    