File: //usr/lib/python3/dist-packages/django/views/decorators/__pycache__/csrf.cpython-310.pyc
o
    ʎ�_  �                   @   s�   d dl mZ d dlmZmZ d dlmZ ee�Zde_de_	G dd� de�Z
ee
�Zde_d	e_	G d
d� de�Zee�Z
de
_d
e
_	dd� ZdS )�    )�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 Zd Zdd� ZdS )�_EnsureCsrfTokenc                 C   �   d S �N� ��self�request�reasonr
   r
   �>/usr/lib/python3/dist-packages/django/views/decorators/csrf.py�_reject   �   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 Zd Zdd� Z� fdd�Z�  ZS )�_EnsureCsrfCookiec                 C   r   r	   r
   r   r
   r
   r   r      r   z_EnsureCsrfCookie._rejectc                    s   t � �||||�}t|� |S r	   )�super�process_viewr   )r   r
   �callback�
callback_args�callback_kwargs�retval��	__class__r
   r   r   "