Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/flask/__pycache__/views.cpython-39.pyc
Ðазад
a p�h� � @ sb d Z ddlmZ ddlmZ eg d��ZG dd� de�ZG dd� de �Z G d d � d ee e��ZdS )z� flask.views ~~~~~~~~~~~ This module provides class-based views inspired by the ones in Django. :copyright: 2010 Pallets :license: BSD-3-Clause � )�with_metaclass)�request)�get�post�head�options�delete�put�trace�patchc @ s0 e Zd ZdZdZdZdZdd� Zedd� �Z dS )�Viewa� Alternative way to use view functions. A subclass has to implement :meth:`dispatch_request` which is called with the view arguments from the URL routing system. If :attr:`methods` is provided the methods do not have to be passed to the :meth:`~flask.Flask.add_url_rule` method explicitly:: class MyView(View): methods = ['GET'] def dispatch_request(self, name): return 'Hello %s!' % name app.add_url_rule('/hello/<name>', view_func=MyView.as_view('myview')) When you want to decorate a pluggable view you will have to either do that when the view function is created (by wrapping the return value of :meth:`as_view`) or you can use the :attr:`decorators` attribute:: class SecretView(View): methods = ['GET'] decorators = [superuser_required] def dispatch_request(self): ... The decorators stored in the decorators list are applied one after another when the view function is created. Note that you can *not* use the class based decorators since those would decorate the view class and not the generated view function! N� c C s t � �dS )z�Subclasses have to override this method to implement the actual view function code. This method is called with all the arguments from the URL rule. N)�NotImplementedError)�selfr r �{/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/flask/views.py�dispatch_requestE s zView.dispatch_requestc sh � ��fdd��| j r8|�_| j�_| j D ]}|���q*| �_|�_| j�_| j�_| j�_| j�_�S )a� Converts the class into an actual view function that can be used with the routing system. Internally this generates a function on the fly which will instantiate the :class:`View` on each request and call the :meth:`dispatch_request` method on it. The arguments passed to :meth:`as_view` are forwarded to the constructor of the class. c s �j � i ���}|j| i |��S )N)� view_classr )�args�kwargsr �� class_args�class_kwargs�viewr r r W s zView.as_view.<locals>.view)� decorators�__name__� __module__r �__doc__�methods�provide_automatic_options)�cls�namer r � decoratorr r r �as_viewL s zView.as_view) r r �__qualname__r r r r r �classmethodr"