Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/flask/__pycache__/views.cpython-37.pyc

80 lines
4.7 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F>]<5D><00> @sndZddlmZddlmZedddddd d
d g<08>ZGd d <0A>d e<07>ZGdd<0F>de <09>Z
Gdd<11>dee
e<08><02>Z dS)z<>
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: 2010 Pallets
:license: BSD-3-Clause
<EFBFBD>)<01>with_metaclass)<01>request<73>get<65>post<73>head<61>options<6E>delete<74>put<75>trace<63>patchc@s0eZdZdZdZdZdZdd<05>Zedd<07><00>Z dS)<08>Viewa<77>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<>cCs
t<00><00>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)<01>NotImplementedError)<01>selfr r <00>./tmp/pip-install-c3kgu56x/Flask/flask/views.py<70>dispatch_requestEszView.dispatch_requestcsl<00><00><01>fdd<02><08>|jr<|<01>_|j<02>_x|jD] }|<04><02><01>q,W|<00>_|<01>_|j<04>_|j<02>_|j<05>_|j<06>_<06>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.
cs<00>j<00><00><01>}|j||<01>S)N)<02>
view_classr)<03>args<67>kwargsr)<03>
class_args<EFBFBD> class_kwargs<67>viewr rrWs zView.as_view.<locals>.view)<07>
decorators<EFBFBD>__name__<5F>
__module__r<00>__doc__<5F>methods<64>provide_automatic_options)<05>cls<6C>namerrZ decoratorr )rrrr<00>as_viewLs   z View.as_view)
rr<00> __qualname__rrrrr<00> classmethodr r r r rr s  r cs eZdZdZ<03>fdd<03>Z<04>ZS)<04>MethodViewTypezYMetaclass for :class:`MethodView` that determines what methods the view
defines.
cs|tt|<00><02>|||<03>d|krxt<03>}x$|D]}t|dd<00>r(|<04>|j<06>q(Wx$tD]}t||<06>rN|<04> |<06>
<EFBFBD><00>qNW|rx||_dS)Nr) <0B>superr#<00>__init__<5F>set<65>getattr<74>updater<00>http_method_funcs<63>hasattr<74>add<64>upper)rr<00>bases<65>dr<00>base<73>key)<01> __class__r rr%ts
 

zMethodViewType.__init__)rrr!rr%<00> __classcell__r r )r1rr#osr#c@seZdZdZdd<03>ZdS)<05>
MethodViewaA class-based view that dispatches request methods to the corresponding
class methods. For example, if you implement a ``get`` method, it will be
used to handle ``GET`` requests. ::
class CounterAPI(MethodView):
def get(self):
return session.get('counter', 0)
def post(self):
session['counter'] = session.get('counter', 0) + 1
return 'OK'
app.add_url_rule('/counter', view_func=CounterAPI.as_view('counter'))
cOsPt|tj<02><03>d<00>}|dkr0tjdkr0t|dd<00>}|dk sFtdtj<00><01>|||<02>S)N<>HEADrzUnimplemented method %r)r'r<00>method<6F>lower<65>AssertionError)rrr<00>methr r rr<00>s
 zMethodView.dispatch_requestN)rrr!rrr r r rr3<00>sr3N) r<00>_compatr<00>globalsr<00> frozensetr)<00>objectr <00>typer#r3r r r r<00><module>
s  [