/usr/local/lib64/python3.6/site-packages/flask/__pycache__
NameSizeModeActions
app.cpython-36.pyc628380644editdlrm
blueprints.cpython-36.pyc218950644editdlrm
cli.cpython-36.pyc268820644editdlrm
config.cpython-36.pyc115620644editdlrm
ctx.cpython-36.pyc154410644editdlrm
debughelpers.cpython-36.pyc63770644editdlrm
globals.cpython-36.pyc17420644editdlrm
helpers.cpython-36.pyc270040644editdlrm
logging.cpython-36.pyc24000644editdlrm
scaffold.cpython-36.pyc247450644editdlrm
sessions.cpython-36.pyc135440644editdlrm
signals.cpython-36.pyc23320644editdlrm
templating.cpython-36.pyc54490644editdlrm
testing.cpython-36.pyc90890644editdlrm
typing.cpython-36.pyc13630644editdlrm
views.cpython-36.pyc49100644editdlrm
wrappers.cpython-36.pyc49010644editdlrm
__init__.cpython-36.pyc18390644editdlrm
__main__.cpython-36.pyc1700644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/flask/__pycache__/views.cpython-36.pyc (4910B)
3 ^TBg< @szddlZddlmZddlmZddlmZedddd d d d d gZGdddZGddde Z Gdddee dZ dS)N) current_app)request)ResponseReturnValuegetpostheadoptionsdeleteputtracepatchc@speZdZUdZdZejejedZ eje  gZ ejej  e dddZeeejejej dddZdS) ViewaAlternative 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/', 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)returncCs tdS)zSubclasses 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,/tmp/pip-build-0s3hx122/flask/flask/views.pydispatch_request>szView.dispatch_request)name class_args class_kwargsrcsztjtjtdfdd |jrJ|_|j_x|jD] }|q:W|_|_|j_|j_|j_|j _ S)aConverts 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. )argskwargsrcsj}tj|j||S)N) view_classr ensure_syncr)rrr)rrviewrrrRs zView.as_view..view) tAnyr decorators__name__ __module__r__doc__methodsprovide_automatic_options)clsrrrZ decoratorr)rrrras_viewEs   z View.as_view)r r! __qualname__r"r#rOptionalZListstrr$boolrCallablerr classmethodrr&rrrrr s   rcs eZdZdZfddZZS)MethodViewTypezYMetaclass for :class:`MethodView` that determines what methods the view defines. csxtj|||d|krtt}x$|D]}t|ddr$|j|jq$Wx$tD]}t||rJ|j|j qJW|rt||_dS)Nr#) super__init__setgetattrupdater#http_method_funcshasattraddupper)r%rbasesdr#basekey) __class__rrr/os    zMethodViewType.__init__)r r!r'r"r/ __classcell__rr)r;rr-jsr-c@s&eZdZdZejejedddZdS) 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')) )rrrcOsXt|tjjd}|dkr0tjdkr0t|dd}|dk sHtdtjtj|||S)NHEADrzUnimplemented method )r1rmethodlowerAssertionErrorrr)rrrmethrrrrs  zMethodView.dispatch_requestN)r r!r'r"rrrrrrrrr=sr=) metaclass) Ztypingrglobalsrrr frozensetr3rtyper-r=rrrrs   ]