§
    ùÛg   ã                   ó¤   — d Z ddlmZ ddlmZ  eg d¢¦  «        Z G d„ de¦  «        Z G d„ de	¦  «        Z
 G d	„ d
 ee
e¦  «        ¦  «        ZdS )zË
    flask.views
    ~~~~~~~~~~~

    This module provides class-based views inspired by the ones in Django.

    :copyright: (c) 2015 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
é   )Úrequest)Úwith_metaclass)ÚgetÚpostÚheadÚoptionsÚdeleteÚputÚtraceÚpatchc                   ó6   — e Zd ZdZdZdZd„ Zed„ ¦   «         ZdS )Ú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 '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© c                 ó   — t          ¦   «         ‚)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.
        )ÚNotImplementedError)Úselfs    úA/granary/edev/quantum/lib/python3.11/site-packages/flask/views.pyÚdispatch_requestzView.dispatch_requestA   s   € õ
 "Ñ#Ô#Ð#ó    c                 óÜ   ‡‡‡— ˆˆˆfd„Š| j         r(|‰_        | j        ‰_        | j         D ]} |‰¦  «        ŠŒ| ‰_        |‰_        | j        ‰_        | j        ‰_        | j        ‰_        ‰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.
        c                  ó8   •—  ‰j         ‰i ‰¤Ž} |j        | i |¤ŽS )N)Ú
view_classr   )ÚargsÚkwargsr   Ú
class_argsÚclass_kwargsÚviews      €€€r   r   zView.as_view.<locals>.viewR   s1   ø€ Ø"�4”? JÐ?°,Ð?Ð?ˆDØ(�4Ô(¨$Ð9°&Ð9Ð9Ð9r   )Ú
decoratorsÚ__name__Ú
__module__r   Ú__doc__Úmethods)ÚclsÚnamer   r   Ú	decoratorr   s     `` @r   Úas_viewzView.as_viewH   s”   øøø€ ð	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð Œ>ð 	'Ø ˆDŒMØ!œnˆDŒOØ œ^ð 'ð '�	Ø �y ‘”��ð ˆŒØˆŒØ”{ˆŒØœ.ˆŒØ”{ˆŒØˆr   )	r   r    Ú__qualname__r!   r"   r   r   Úclassmethodr&   r   r   r   r   r      sW   € € € € € ðð ð@ €Gð €Jð$ð $ð $ð ðð ñ „[ðð ð r   r   c                   ó   — e Zd Zd„ ZdS )ÚMethodViewTypec                 ó
  — t                                | |||¦  «        }d|vrat          |j        pg ¦  «        }|D ]2}|t          v r'|                     |                     ¦   «         ¦  «         Œ3|rt          |¦  «        |_        |S )Nr"   )ÚtypeÚ__new__Úsetr"   Úhttp_method_funcsÚaddÚupperÚsorted)r#   r$   ÚbasesÚdÚrvr"   Úkeys          r   r-   zMethodViewType.__new__k   sŠ   € Ý�\Š\˜#˜t U¨AÑ.Ô.ˆØ˜AÐÐÝ˜"œ*Ð*¨Ñ+Ô+ˆGØð -ð -�ØÕ+Ð+Ð+Ø—K’K §	¢	¡¤Ñ,Ô,Ð,øð
 ð -Ý# G™_œ_�”
Øˆ	r   N)r   r    r'   r-   r   r   r   r*   r*   i   s#   € € € € € ðð ð ð ð r   r*   c                   ó   — e Zd ZdZd„ ZdS )Ú
MethodViewa­  Like a regular class-based view but that dispatches requests to
    particular methods.  For instance if you implement a method called
    :meth:`get` it means you will response to ``'GET'`` requests and
    the :meth:`dispatch_request` implementation will automatically
    forward your request to that.  Also :attr:`options` is set for you
    automatically::

        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'))
    c                 óä   — t          | t          j                             ¦   «         d ¦  «        }|€!t          j        dk    rt          | dd ¦  «        }|€J dt          j        z  ¦   «         ‚ ||i |¤ŽS )NÚHEADr   zUnimplemented method %r)Úgetattrr   ÚmethodÚlower)r   r   r   Úmeths       r   r   zMethodView.dispatch_requestŽ   sv   € Ý�t�Wœ^×1Ò1Ñ3Ô3°TÑ:Ô:ˆð ˆ<�GœN¨fÒ4Ð4Ý˜4 ¨Ñ-Ô-ˆDØÐÐÐ!:½W¼^Ñ!KÑÔÐØˆt�TÐ$˜VÐ$Ð$Ð$r   N)r   r    r'   r!   r   r   r   r   r8   r8   {   s-   € € € € € ðð ð$%ð %ð %ð %ð %r   r8   N)r!   Úglobalsr   Ú_compatr   Ú	frozensetr/   Úobjectr   r,   r*   r8   r   r   r   ú<module>rC      sú   ððð ð Ð Ð Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #ð �Ið Bð Bð Bñ Cô CÐ ðSð Sð Sð Sð Sˆ6ñ Sô Sð Sðlð ð ð ð �Tñ ô ð ð$%ð %ð %ð %ð %�� °Ñ5Ô5ñ %ô %ð %ð %ð %r   