a
    [f                     @   s   d dl mZ d dlmZmZ d dlmZ eeZde_de_	G dd deZ
ee
Zde_d	e_	G d
d deZeeZde_de_	dd ZdS )    )wraps)CsrfViewMiddleware	get_token)decorator_from_middlewarecsrf_protectz
This decorator adds CSRF protection in exactly the same way as
CsrfViewMiddleware, but it can be used on a per view basis.  Using both, or
using the decorator multiple times, is harmless and efficient.
c                   @   s   e Zd Zdd ZdS )_EnsureCsrfTokenc                 C   s   d S N selfrequestreasonr	   r	   nC:\Users\91910\OneDrive\Desktop\vts_admin_rebuild-master\vts\Lib\site-packages\django/views/decorators/csrf.py_reject   s    z_EnsureCsrfToken._rejectN)__name__
__module____qualname__r   r	   r	   r	   r   r      s   r   requires_csrf_tokenz
Use this decorator on views that need a correct csrf_token available to
RequestContext, but without the CSRF protection that csrf_protect
enforces.
c                       s$   e Zd Zdd Z fddZ  ZS )_EnsureCsrfCookiec                 C   s   d S r   r	   r
   r	   r	   r   r      s    z_EnsureCsrfCookie._rejectc                    s   t  ||||}t| |S r   )superprocess_viewr   )r   r   callbackcallback_argscallback_kwargsretval	__class__r	   r   r   "   s    z_EnsureCsrfCookie.process_view)r   r   r   r   r   __classcell__r	   r	   r   r   r      s   r   ensure_csrf_cookiez
Use this decorator to ensure that a view sets a CSRF cookie, whether or not it
uses the csrf_token template tag, or the CsrfViewMiddleware is used.
c                    s   t   fdd}d|_|S )zCMark a view function as being exempt from the CSRF view protection.c                     s    | i |S r   r	   )argskwargs	view_funcr	   r   wrapper_view6   s    z!csrf_exempt.<locals>.wrapper_viewT)r   csrf_exempt)r"   r#   r	   r!   r   r$   1   s    r$   N)	functoolsr   Zdjango.middleware.csrfr   r   Zdjango.utils.decoratorsr   r   r   __doc__r   r   r   r   r$   r	   r	   r	   r   <module>   s   