Sindbad~EG File Manager
3
Ĝg< � @ sz d dl ZddlmZ ddlmZ ddl mZ edddd d
ddd
g�ZG dd� d�ZG dd� de �Z
G dd� dee
d�ZdS )� N� )�current_app)�request)�ResponseReturnValue�get�post�head�options�delete�put�trace�patchc @ sp e Zd ZU dZdZejeje dZ eje
g Zejej e
d�dd�Zeeejejejd�dd��ZdS ) �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 f"Hello {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)�returnc 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)�self� r �,/tmp/pip-build-fsllo_ck/Flask/flask/views.py�dispatch_request>