← Back
Editing: csrf.cpython-311.pyc
� �|�e � � � d dl mZ d dlmZmZ d dlmZ ee� � Zde_ de_ G d� de� � Z ee � � Zde_ d e_ G d � de� � Z ee� � Z de _ d e _ d� 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 � � e Zd Zd� ZdS )�_EnsureCsrfTokenc � � d S �N� ��self�request�reasons �>/usr/lib/python3/dist-packages/django/views/decorators/csrf.py�_rejectz_EnsureCsrfToken._reject � � ��t� N)�__name__� __module__�__qualname__r r r r r r s# � � � � � �� � � � r 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 �$ � � e Zd Zd� Z� fd�Z� xZS )�_EnsureCsrfCookiec � � d S r r r s r r z_EnsureCsrfCookie._reject r r c �n �� t � � � ||||� � }t |� � |S r )�super�process_viewr )r r �callback� callback_args�callback_kwargs�retval� __class__s �r r z_EnsureCsrfCookie.process_view"