Files
proxmox/venv/lib/python3.12/site-packages/flask/__pycache__/views.cpython-312.pyc

89 lines
6.8 KiB
Plaintext
Raw Normal View History

<EFBFBD>
<0E>Hi2<00><01><><00>ddlmZddlZddlmZddlmZddlmZejdejdejf<00> <09>Z e gd
<EFBFBD><01>ZGd <0B>d <0C>ZGd <0A>de<0F>Zy)<0F>)<01> annotationsN<73>)<01>typing)<01> current_app)<01>request<73>F.)<01>bound)<08>get<65>post<73>head<61>options<6E>delete<74>put<75>trace<63>patchc<01>t<00>eZdZUdZdZded<dZded<gZded<d Zd
ed <dd <0C>Z e
dd <0A><04>Z y)<10>ViewaSubclass this class and override :meth:`dispatch_request` to
create a generic class-based view. Call :meth:`as_view` to create a
view function that creates an instance of the class with the given
arguments and calls its ``dispatch_request`` method with any URL
variables.
See :doc:`views` for a detailed guide.
.. code-block:: python
class Hello(View):
init_every_request = False
def dispatch_request(self, name):
return f"Hello, {name}!"
app.add_url_rule(
"/hello/<name>", view_func=Hello.as_view("hello")
)
Set :attr:`methods` on the class to change what methods the view
accepts.
Set :attr:`decorators` on the class to apply a list of decorators to
the generated view function. Decorators applied to the class itself
will not be applied to the generated view function!
Set :attr:`init_every_request` to ``False`` for efficiency, unless
you need to store request-global data on ``self``.
Nz$t.ClassVar[t.Collection[str] | None]<5D>methodszt.ClassVar[bool | None]<5D>provide_automatic_optionsz(t.ClassVar[list[t.Callable[..., t.Any]]]<5D>
decoratorsTzt.ClassVar[bool]<5D>init_every_requestc<01><00>t<00><00>)z<>The actual view function behavior. Subclasses must override
this and return a valid response. Any variables from the URL
rule are passed as keyword arguments.
)<01>NotImplementedError)<01>selfs <20>M/home/intlc/projects/proxmox/venv/lib/python3.12/site-packages/flask/views.py<70>dispatch_requestzView.dispatch_requestNs <00><00>
"<22>#<23>#<23>c<01>r<00><02><03><05><06>|jr d<03><02><03>fd<01> <0C>n|<00>i<00><03><01><01>d<03>fd<02> <0C>|jr1|<01>_|j<00>_|jD]
}|<04><06><00><06> |<00>_|<01>_|j
<00>_|j<00>_|j <00>_|j<00>_<00>S)afConvert the class into a view function that can be registered
for a route.
By default, the generated view will create a new instance of the
view class for every request and call its
:meth:`dispatch_request` method. If the view class sets
:attr:`init_every_request` to ``False``, the same instance will
be used for every request.
Except for ``name``, all other arguments passed to this method
are forwarded to the view class ``__init__`` method.
.. versionchanged:: 2.2
Added the ``init_every_request`` class attribute.
c<01>r<00><03><00>j<00>i<00><03><01>}tj|j<00>di|<00><01>S<00>N<>)<04>
view_classr<00> ensure_syncr)<05>kwargsr<00>
class_args<EFBFBD> class_kwargs<67>views <20><><EFBFBD>rr'zView.as_view.<locals>.viewjsB<00><><00>&<26>t<EFBFBD><EFBFBD><EFBFBD><1F><12>#/<2F><12><04>F<01>{<7B>.<2E>.<2E>t<EFBFBD>/D<>/D<>E<>O<><06>O<>Orc<01>N<00><01>tj<00>j<00>di|<00><01>Sr )rr#r)r$rs <20>rr'zView.as_view.<locals>.viewss$<00><><00>E<>{<7B>.<2E>.<2E>t<EFBFBD>/D<>/D<>E<>O<><06>O<>Or<00>r$<00>t.Any<6E>return<72>ft.ResponseReturnValue)rr<00>__name__<5F>
__module__r"<00>__doc__rr)<07>cls<6C>namer%r&<00> decoratorrr's `` @@r<00>as_viewz View.as_viewUs<><00><><00>& <0F> !<21> !<21> P<01> P<01><17>
<EFBFBD>3<>l<EFBFBD>3<>D<EFBFBD> P<01> <0F>><3E>><3E> <20>D<EFBFBD>M<EFBFBD>!<21>n<EFBFBD>n<EFBFBD>D<EFBFBD>O<EFBFBD> <20>^<5E>^<5E> '<27> <09> <20><14><EFBFBD><04> '<27><1E><04><0F><1C><04> <0A><1A>{<7B>{<7B><04> <0C><1D>.<2E>.<2E><04><0F><1A>{<7B>{<7B><04> <0C>),<2C>)F<>)F<><04>&<26><13> r)r+r,)r1<00>strr%r*r&r*r+zft.RouteCallable) r-r.<00> __qualname__r/r<00>__annotations__rrrr<00> classmethodr3r!rrrrsw<00><00><08>D59<35>G<EFBFBD> 1<>8<>
:><3E><1D>6<>=<3D><><3E>J<EFBFBD>8<>=<3D>,0<><16>(<28>/<2F>$<24><11>1<14><16>1<14>%*<2A>1<14><A<>1<14> <19>1<14><11>1rrc<01>,<00><00>eZdZdZd<04>fd<02> Zdd<03>Z<05>xZS)<06>
MethodViewa<EFBFBD>Dispatches request methods to the corresponding instance methods.
For example, if you implement a ``get`` method, it will be used to
handle ``GET`` requests.
This can be useful for defining a REST API.
:attr:`methods` is automatically set based on the methods defined on
the class.
See :doc:`views` for a detailed guide.
.. code-block:: python
class CounterAPI(MethodView):
def get(self):
return str(session.get("counter", 0))
def post(self):
session["counter"] = session.get("counter", 0) + 1
return redirect(url_for("counter"))
app.add_url_rule(
"/counter", view_func=CounterAPI.as_view("counter")
)
c <01>L<00><01>t<00>|<00>di|<01><01>d|jvr<>t<00>}|jD]+}t |dd<00>s<01>|j |j<00><00>-tD].}t||<04>s<01>|j|j<00><00><00>0|r||_yyy)Nrr!) <0C>super<65>__init_subclass__<5F>__dict__<5F>set<65> __bases__<5F>getattr<74>updater<00>http_method_funcs<63>hasattr<74>add<64>upper)r0r$r<00>base<73>key<65> __class__s <20>rr<zMethodView.__init_subclass__<5F>s<><00><><00> <0A><07>!<21>+<2B>F<EFBFBD>+<2B> <14>C<EFBFBD>L<EFBFBD>L<EFBFBD> (<28><19>e<EFBFBD>G<EFBFBD><1B> <0A> <0A> 1<><04><1A>4<EFBFBD><19>D<EFBFBD>1<><1B>N<EFBFBD>N<EFBFBD>4<EFBFBD><<3C><<3C>0<> 1<>)<29> -<2D><03><1A>3<EFBFBD><03>$<24><1B>K<EFBFBD>K<EFBFBD><03> <09> <09> <0B>,<2C> -<2D><17>%<25><03> <0B><17> )rc <01><00>t|tjj<00>d<00>}|<02> tjdk(r t|dd<00>}|<02>Jdtj<00><02><02><00>t j
|<02>di|<01><01>S)N<>HEADr
zUnimplemented method r!)r@r<00>method<6F>lowerrr#)rr$<00>meths rrzMethodView.dispatch_request<73>sv<00><00><16>t<EFBFBD>W<EFBFBD>^<5E>^<5E>1<>1<>3<>T<EFBFBD>:<3A><04> <10><<3C>G<EFBFBD>N<EFBFBD>N<EFBFBD>f<EFBFBD>4<><1A>4<EFBFBD><15><04>-<2D>D<EFBFBD><13><1F>K<>#8<><17><1E><1E>8J<38>!K<>K<><1F>,<2C>{<7B>&<26>&<26>t<EFBFBD>,<2C>6<>v<EFBFBD>6<>6r)r$r*r+<00>Noner))r-r.r5r/r<r<00> __classcell__)rHs@rr9r9<00>s<00><><00><08>4&<26>" 7rr9)<11>
__future__rr<00>t<><00>ft<66>globalsrr<00>TypeVar<61>Callable<6C>Anyr<00> frozensetrBrr9r!rr<00><module>rYs^<00><01>"<22><12><1A> <20><1C> <0A>A<EFBFBD>I<EFBFBD>I<EFBFBD>c<EFBFBD><11><1A><1A>C<EFBFBD><11><15><15>J<EFBFBD>/<2F>0<><01><1D>I<><02><11>
w<14>w<14>t57<><14>57r