Files
loustique-home/venv/lib/python3.11/site-packages/flask/__pycache__/views.cpython-311.pyc

89 lines
7.3 KiB
Plaintext
Raw Normal View History

2026-03-21 10:53:02 +01:00
<EFBFBD>
<00><><EFBFBD>i2<00><01><><00>ddlmZddlZddlmZddlmZddlmZej dej
dej f<00> <09><00>Z e gd
<EFBFBD><01><00>ZGd <0B>d <0C><00>ZGd <0A>de<0F><00>ZdS)<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>l<00>eZdZUdZdZded<dZded<gZded<d Zd
ed <dd<0E>Z e
dd<15><04><00>Z dS)<18>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_request<73>return<72>ft.ResponseReturnValuec<01><00>t<00><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>W/home/maxime/Documents/loustiques-home/venv/lib/python3.11/site-packages/flask/views.py<70>dispatch_requestzView.dispatch_requestNs<00><00>
"<22>#<23>#<23>#<23><00>name<6D>str<74>
class_args<EFBFBD>t.Any<6E> class_kwargs<67>ft.RouteCallablec<01>$<00><02><03><05><06>|jr d<07><02><03>fd<05> <0C>n|<00>i<00><03><01><01>d<07>fd<06> <0C>|jr(|<01>_|j<00>_|jD] }|<04><06><00><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.
<20>kwargsr#rrc<01>\<00><03><00>j<00>i<00><03><01>}tj|j<00><00>di|<00><01>S<00>N<>)<04>
view_classr<00> ensure_syncr)r'rr"r$<00>views <20><><EFBFBD>rr-zView.as_view.<locals>.viewjsH<00><><00>&<26>t<EFBFBD><EFBFBD><1F><12>#/<2F><12><12><04>F<01>{<7B>.<2E>t<EFBFBD>/D<>E<>E<>O<>O<><06>O<>O<>Orc<01>B<00><01>tj<00>j<00><00>di|<00><01>Sr))rr,r)r'rs <20>rr-zView.as_view.<locals>.viewss'<00><><00>E<>{<7B>.<2E>t<EFBFBD>/D<>E<>E<>O<>O<><06>O<>O<>Or<00>r'r#rr)rr<00>__name__<5F>
__module__r+<00>__doc__rr)<07>clsr r"r$<00> decoratorrr-s `` @@r<00>as_viewz View.as_viewUs<><00><><EFBFBD><EFBFBD><EFBFBD><00>& <0F> !<21> P<01> P<01> P<01> P<01> P<01> P<01> P<01> P<01> P<01> P<01><17>3<EFBFBD>
<EFBFBD>3<>l<EFBFBD>3<>3<>D<EFBFBD> P<01> P<01> P<01> P<01> P<01> P<01> <0F>><3E> '<27> <20>D<EFBFBD>M<EFBFBD>!<21>n<EFBFBD>D<EFBFBD>O<EFBFBD> <20>^<5E> '<27> '<27> <09> <20>y<EFBFBD><14><EFBFBD><EFBFBD><04><04><1E><04><0F><1C><04> <0A><1A>{<7B><04> <0C><1D>.<2E><04><0F><1A>{<7B><04> <0C>),<2C>)F<><04>&<26><13> r)rr)r r!r"r#r$r#rr%) r0r1<00> __qualname__r2r<00>__annotations__rrrr<00> classmethodr5r*rrrrs<><00><00><00><00><00><00><00><08><08>D59<35>G<EFBFBD>8<>8<>8<>8<>
:><3E><1D>=<3D>=<3D>=<3D>=<3D><><3E>J<EFBFBD>=<3D>=<3D>=<3D>=<3D>,0<><16>/<2F>/<2F>/<2F>/<2F>$<24>$<24>$<24>$<24><11>1<14>1<14>1<14><11>[<5B>1<14>1<14>1rrc<01>,<00><00>eZdZdZd <09>fd<06> Zd
d<08>Z<05>xZS) <0B>
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")
)
r'r#r<00>Nonec <01>n<00><01>t<00><00>jdi|<01><01>d|jvr<>t<00><00>}|jD]-}t |dd<00><00>r|<02>|j<00><00><00>.tD]9}t||<04><00>r'|<02>
|<04> <00><00><00><00><00>:|r ||_dSdSdS)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)r3r'r<00>base<73>key<65> __class__s <20>rr>zMethodView.__init_subclass__<5F>s<><00><><00>!<21><05><07><07>!<21>+<2B>+<2B>F<EFBFBD>+<2B>+<2B>+<2B> <14>C<EFBFBD>L<EFBFBD> (<28> (<28><19>e<EFBFBD>e<EFBFBD>G<EFBFBD><1B> <0A> 1<> 1<><04><1A>4<EFBFBD><19>D<EFBFBD>1<>1<>1<><1B>N<EFBFBD>N<EFBFBD>4<EFBFBD><<3C>0<>0<>0<><30>(<28> -<2D> -<2D><03><1A>3<EFBFBD><03>$<24>$<24>-<2D><1B>K<EFBFBD>K<EFBFBD><03> <09> <09> <0B> <0B>,<2C>,<2C>,<2C><><16> &<26>%<25><03> <0B> <0B> <0B> )<29> (<28> &<26> &rrc <01><00>t|tj<00><00><00>d<00><00>}|<02>!tjdkrt|dd<00><00>}|<02>Jdtj<00><02><02><00><00>t j|<02><00>di|<01><01>S)N<>HEADr
zUnimplemented method r*)rBr<00>method<6F>lowerrr,)rr'<00>meths rrzMethodView.dispatch_request<73>s<><00><00><16>t<EFBFBD>W<EFBFBD>^<5E>1<>1<>3<>3<>T<EFBFBD>:<3A>:<3A><04> <10><<3C>G<EFBFBD>N<EFBFBD>f<EFBFBD>4<>4<><1A>4<EFBFBD><15><04>-<2D>-<2D>D<EFBFBD><13><1F><1F>!K<><17><1E>!K<>!K<><1F><1F><1F>,<2C>{<7B>&<26>t<EFBFBD>,<2C>,<2C>6<>6<>v<EFBFBD>6<>6<>6r)r'r#rr;r/)r0r1r6r2r>r<00> __classcell__)rJs@rr:r:<00>s[<00><><00><00><00><00><00><08><08>4&<26>&<26>&<26>&<26>&<26>&<26>" 7<> 7<> 7<> 7<> 7<> 7<> 7<> 7rr:)<11>
__future__rr<00>t<><00>ft<66>globalsrr<00>TypeVar<61>Callable<6C>Anyr<00> frozensetrDrr:r*rr<00><module>rZs<><00><01>"<22>"<22>"<22>"<22>"<22>"<22><12><12><12><12><1A><1A><1A><1A><1A><1A> <20> <20> <20> <20> <20> <20><1C><1C><1C><1C><1C><1C> <0A>A<EFBFBD>I<EFBFBD>c<EFBFBD><11><1A>C<EFBFBD><11><15>J<EFBFBD>/<2F>0<>0<>0<><01><1D>I<EFBFBD>I<>I<>I<><02><02><11>
w<14>w<14>w<14>w<14>w<14>w<14>w<14>w<14>t57<>57<>57<>57<>57<><14>57<>57<>57<>57<>57r