Files
wg-backend-django/dell-env/lib/python3.11/site-packages/flask/__pycache__/scaffold.cpython-311.pyc

404 lines
37 KiB
Plaintext
Raw Normal View History

2023-10-30 14:40:43 +07:00
<EFBFBD>
~]?ev<65><00><00>:<00>ddlZddlZddlZddlZddlZddlZddlZddl m
Z
ddl m Z ddl mZddlmZddlmZddlmZdd lmZdd
lmZdd lmZdd lmZdd lmZddlmZddlmZej rddl!m"Z"e#<23><00>Z$ej%dej&dej'f<00><13><00>Z(ej%dej)<00><13><00>Z*ej%dej+<00><13><00>Z,ej%dej-<00><13><00>Z.ej%dej/<00><13><00>Z0ej%dej1<00><13><00>Z2ej%dej3<00><13><00>Z4ej%dej5<00><13><00>Z6ej%dej7<00><13><00>Z8de(de(fd<1E>Z9Gd<1F>d <20><00>Z:d!ej&de;fd"<22>Z<d#<23>Z=d$ej>d%e;de?fd&<26>Z@d'<27>ZAd(e;fd)<29>ZBdS)*<2A>N)<01> defaultdict)<01> timedelta)<01>update_wrapper)<01>FileSystemLoader)<01>default_exceptions)<01> HTTPException<6F>)<01>typing)<01>AppGroup)<01> current_app)<01> get_root_path)<01>locked_cached_property)<01>send_from_directory)<01>_default_template_ctx_processor)<01>Response<73>F.)<01>bound<6E>T_after_request<73>T_before_request<73>T_error_handler<65>
T_teardown<EFBFBD>T_template_context_processor<6F>T_url_defaults<74>T_url_value_preprocessor<6F>T_route<74>f<>returnc<00><><00><00><02><00>j<00>dtjdtjdtjf<06><00>fd<04> }tjtt |<01><00><00><00><00>S)N<>args<67>kwargsrc<00>F<00><02>|<00><00><04><00><00>|g|<01>Ri|<02><01>S<00>N)<01>_check_setup_finished)<05>selfrr r<00>f_names <20><><EFBFBD>g/home/infidel/Sync/TIP/WireGuard/ocp-wg-backend/dell-env/lib/python3.11/site-packages/flask/scaffold.py<70> wrapper_funcz!setupmethod.<locals>.wrapper_func0s7<00><><00> <0C>"<22>"<22>6<EFBFBD>*<2A>*<2A>*<2A><10>q<EFBFBD><14>'<27><04>'<27>'<27>'<27><06>'<27>'<27>'<27>)<06>__name__<5F>t<>Any<6E>castrr)rr'r%s` @r&<00> setupmethodr--sg<00><><EFBFBD><00> <0E>Z<EFBFBD>F<EFBFBD>(<28>!<21>%<25>(<28>1<EFBFBD>5<EFBFBD>(<28>Q<EFBFBD>U<EFBFBD>(<28>(<28>(<28>(<28>(<28>(<28>(<28> <0A>6<EFBFBD>!<21>^<5E>L<EFBFBD>!<21>4<>4<> 5<> 5<>5r(c<00><><00>eZdZUdZeed<dZejeed<dZ ejeed<dZ
ej ej e jdfed<dZej ej e jdfed< d<ded ejej eejfd
ejed ejej eejfd ejef
d <0A>Zdefd<0F>Zdeddfd<11>Zedejefd<12><04><00>Zejdejej eejfddfd<14><04><00>Zedefd<15><04><00>Zedejefd<16><04><00>Zejdejeddfd<17><04><00>Zdejedejefd<19>Zdeddfd<1B>Zedeje fd<1C><04><00>Z!d=dededej"ej#fd <20>Z$d!ed"ed#e%dej&e'ge'ffd$<24>Z(e)d"ed#ej*dej&e'ge'ffd%<25><04><00>Z+e)d"ed#ej*dej&e'ge'ffd&<26><04><00>Z,e)d"ed#ej*dej&e'ge'ffd'<27><04><00>Z-e)d"ed#ej*dej&e'ge'ffd(<28><04><00>Z.e)d"ed#ej*dej&e'ge'ffd)<29><04><00>Z/e)d"ed#ej*dej&e'ge'ffd*<2A><04><00>Z0e) d>d"ed+ejed,eje1j2d-ejed#ej*ddf d.<2E><05><00>Z3e)d+edej&e4ge4ffd/<2F><04><00>Z5e)d0e6de6fd1<64><04><00>Z7e)d0e8de8fd2<64><04><00>Z9e)d0e:de:fd3<64><04><00>Z;e)d0e<de<fd4<64><04><00>Z=e)d0e>de>fd5<64><04><00>Z?e)d0e@de@fd6<64><04><00>ZAe)d7ej ej eBefdej&eCgeCffd8<64><04><00>ZDe)d7ej ej eBefd0e1jEddfd9<64><04><00>ZFeGd:ej ej eBefdejHej eBejeffd;<3B><04><00>ZIdS)?<3F>Scaffolda<64>Common behavior shared between :class:`~flask.Flask` and
:class:`~flask.blueprints.Blueprint`.
:param import_name: The import name of the module where this object
is defined. Usually :attr:`__name__` should be used.
:param static_folder: Path to a folder of static files to serve.
If this is set, a static route will be added.
:param static_url_path: URL prefix for the static route.
:param template_folder: Path to a folder containing template files.
for rendering. If this is set, a Jinja loader will be added.
:param root_path: The path that static, template, and resource files
are relative to. Typically not set, it is discovered based on
the ``import_name``.
.. versionadded:: 2.0
<20>nameN<65>_static_folder<65>_static_url_path<74> json_encoder<65> json_decoder<65> import_name<6D> static_folder<65>static_url_path<74>template_folder<65> root_pathc<00><00>||_||_||_||_|<05>t |j<00><00>}||_t <00><00>|_i|_td<01><00><00>|_
tt<00><00>|_ tt<00><00>|_ tt<00><00>|_ttdtgi<01><00>|_tt<00><00>|_tt<00><00>|_dS)Nc<00>*<00>tt<00><00>Sr")r<00>dict<63>r(r&<00><lambda>z#Scaffold.__init__.<locals>.<lambda><3E>s<00><00> <0B>D<EFBFBD> 1<> 1<>r()r5r6r7r8r r9r <00>cli<6C>view_functionsr<00>error_handler_spec<65>list<73>before_request_funcs<63>after_request_funcs<63>teardown_request_funcsr<00>template_context_processors<72>url_value_preprocessors<72>url_default_functions)r$r5r6r7r8r9s r&<00>__init__zScaffold.__init__[s<00><00>'<27><04><18>*<2A><04><1A>.<2E><04><1C>
/<2F><04><1C> <14> <1C>%<25>d<EFBFBD>&6<>7<>7<>I<EFBFBD>#<23><04><0E> <1C>:<3A>:<3A><04><08>8:<3A><04><1B>$ <18>1<>1<> 2<> 2<> <0A><1F>" <18><04> <1D> <1D> <0A>!<21> <18><04> <1D> <1D> <0A> <20>" <18><04> <1D> <1D> <0A>#<23>" <18><04>t<EFBFBD>&E<>%F<>G<> H<> H<> <0A>(<28>$ <18><04> <1D> <1D> <0A>$<24>$ <18><04> <1D> <1D> <0A>"<22>"<22>"r(rc<00>B<00>dt|<00><00>j<00>d|j<00>d<03>S)N<><<3C> <20>>)<03>typer)r0<00>r$s r&<00>__repr__zScaffold.__repr__<5F>s&<00><00>7<>4<EFBFBD><04>:<3A>:<3A>&<26>7<>7<><14><19>7<>7<>7<>7r(r%c<00><00>t<00>r"<00><01>NotImplementedError)r$r%s r&r#zScaffold._check_setup_finished<65>s<00><00>!<21>!r(c<00>h<00>|j<00>*tj<00>|j|j<00><00>SdS)zhThe absolute path to the configured static folder. ``None``
if no static folder is set.
N)r1<00>os<6F>path<74>joinr9rOs r&r6zScaffold.static_folder<65>s-<00><00>
<10> <1E> *<2A><15>7<EFBFBD><<3C><<3C><04><0E><04>0C<30>D<>D<> D<><17>4r(<00>valuec<00>f<00>|<01>'tj|<01><00><00>d<01><00>}||_dS)Nz\/)rU<00>fspath<74>rstripr1<00>r$rXs r&r6zScaffold.static_folder<65>s3<00><00> <10> <1C><16>I<EFBFBD>e<EFBFBD>$<24>$<24>+<2B>+<2B>E<EFBFBD>2<>2<>E<EFBFBD>#<23><04><1B><1B>r(c<00><00>|jduS)zQ``True`` if :attr:`static_folder` is set.
.. versionadded:: 0.5
N)r6rOs r&<00>has_static_folderzScaffold.has_static_folders<00><00> <14>!<21><14>-<2D>-r(c<00><><00>|j<00>|jS|j<00><tj<00>|j<00><00>}d|<01><00><02>d<02><00>SdS)z<>The URL prefix that the static route will be accessible from.
If it was not configured during init, it is derived from
:attr:`static_folder`.
N<>/)r2r6rUrV<00>basenamer[)r$ras r&r7zScaffold.static_url_pathsV<00><00> <10> <20> ,<2C><17>(<28> (<28> <0F> <1D> )<29><19>w<EFBFBD>'<27>'<27><04>(:<3A>;<3B>;<3B>H<EFBFBD>!<21>x<EFBFBD>><3E>><3E>(<28>(<28><13>-<2D>-<2D> -<2D><13>tr(c<00>B<00>|<01>|<01>d<01><00>}||_dS)Nr`)r[r2r\s r&r7zScaffold.static_url_paths'<00><00> <10> <1C><19>L<EFBFBD>L<EFBFBD><13>%<25>%<25>E<EFBFBD> %<25><04><1D><1D>r(<00>filenamec<00><><00>tjd}|<02>dSt|t<00><00>r!t |<02><00><00><00><00>S|S)aUsed by :func:`send_file` to determine the ``max_age`` cache
value for a given file path if it wasn't passed.
By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from
the configuration of :data:`~flask.current_app`. This defaults
to ``None``, which tells the browser to use conditional requests
instead of a timed cache, which is usually preferable.
.. versionchanged:: 2.0
The default configuration is ``None`` instead of 12 hours.
.. versionadded:: 0.9
<20>SEND_FILE_MAX_AGE_DEFAULTN)r <00>config<69>
isinstancer<00>int<6E> total_seconds)r$rcrXs r&<00>get_send_file_max_agezScaffold.get_send_file_max_age%sM<00><00><1C>"<22>#><3E>?<3F><05> <10>=<3D><17>4<EFBFBD> <15>e<EFBFBD>Y<EFBFBD> '<27> '<27> .<2E><16>u<EFBFBD>*<2A>*<2A>,<2C>,<2C>-<2D>-<2D> -<2D><14> r(rc<00><><00>|jstd<01><00><00>|<00>|<01><00>}tt jt |j<00><00>||<02><02><00>S)z<>The view function used to serve files from
:attr:`static_folder`. A route is automatically registered for
this view at :attr:`static_url_path` if :attr:`static_folder` is
set.
.. versionadded:: 0.5
z2'static_folder' must be set to serve static_files.)<01>max_age)r^<00> RuntimeErrorrjrr*r,<00>strr6)r$rcrls r&<00>send_static_filezScaffold.send_static_file=sa<00><00><14>%<25> U<01><1E>S<>T<>T<> T<><17>,<2C>,<2C>X<EFBFBD>6<>6<><07>"<22> <0A>F<EFBFBD>3<EFBFBD><04>*<2A> +<2B> +<2B>X<EFBFBD>w<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD>
r(c<00><><00>|j<00>7ttj<00>|j|j<00><00><00><00>SdS)z<>The Jinja loader for this object's templates. By default this
is a class :class:`jinja2.loaders.FileSystemLoader` to
:attr:`template_folder` if it is set.
.. versionadded:: 0.5
N)r8rrUrVrWr9rOs r&<00> jinja_loaderzScaffold.jinja_loaderOs5<00><00> <10> <1F> +<2B>#<23>B<EFBFBD>G<EFBFBD>L<EFBFBD>L<EFBFBD><14><1E><14>AU<41>$V<>$V<>W<>W<> W<><17>4r(<00>rb<72>resource<63>modec<00><><00>|dvrtd<02><00><00>ttj<00>|j|<01><00>|<02><00>S)aKOpen a resource file relative to :attr:`root_path` for
reading.
For example, if the file ``schema.sql`` is next to the file
``app.py`` where the ``Flask`` app is defined, it can be opened
with:
.. code-block:: python
with app.open_resource("schema.sql") as f:
conn.executescript(f.read())
:param resource: Path to the resource relative to
:attr:`root_path`.
:param mode: Open the file in this mode. Only reading is
supported, valid values are "r" (or "rt") and "rb".
><00>rrr<00>rtz)Resources can only be opened for reading.)<06>
ValueError<EFBFBD>openrUrVrWr9)r$rsrts r&<00> open_resourcezScaffold.open_resource\sA<00><00>$ <10>(<28> (<28> (<28><1C>H<>I<>I<> I<><13>B<EFBFBD>G<EFBFBD>L<EFBFBD>L<EFBFBD><14><1E><18>:<3A>:<3A>D<EFBFBD>A<>A<>Ar(<00>method<6F>rule<6C>optionsc<00>J<00>d|vrtd<02><00><00>|j|fd|gi|<03><01>S)N<>methodsz8Use the 'route' decorator to use the 'methods' argument.)<02> TypeError<6F>route)r$r{r|r}s r&<00> _method_routezScaffold._method_routess?<00><00> <15><07> <1F> <1F><1B>V<>W<>W<> W<><19>t<EFBFBD>z<EFBFBD>$<24><<3C><<3C><16><08><<3C>G<EFBFBD><<3C><<3C><r(c <00>0<00>|<00>d||<02><00>S)z\Shortcut for :meth:`route` with ``methods=["GET"]``.
.. versionadded:: 2.0
<20>GET<45>r<><00>r$r|r}s r&<00>getz Scaffold.get~<00><00><00> <14>!<21>!<21>%<25><14>w<EFBFBD>7<>7<>7r(c <00>0<00>|<00>d||<02><00>S)z]Shortcut for :meth:`route` with ``methods=["POST"]``.
.. versionadded:: 2.0
<20>POSTr<54>r<>s r&<00>postz Scaffold.post<73>s<00><00> <14>!<21>!<21>&<26>$<24><07>8<>8<>8r(c <00>0<00>|<00>d||<02><00>S)z\Shortcut for :meth:`route` with ``methods=["PUT"]``.
.. versionadded:: 2.0
<20>PUTr<54>r<>s r&<00>putz Scaffold.put<75>r<>r(c <00>0<00>|<00>d||<02><00>S)z_Shortcut for :meth:`route` with ``methods=["DELETE"]``.
.. versionadded:: 2.0
<20>DELETEr<45>r<>s r&<00>deletezScaffold.delete<74>s<00><00> <14>!<21>!<21>(<28>D<EFBFBD>'<27>:<3A>:<3A>:r(c <00>0<00>|<00>d||<02><00>S)z^Shortcut for :meth:`route` with ``methods=["PATCH"]``.
.. versionadded:: 2.0
<20>PATCHr<48>r<>s r&<00>patchzScaffold.patch<63>s<00><00> <14>!<21>!<21>'<27>4<EFBFBD><17>9<>9<>9r(c <00>8<00><00><01><02>dtdtf<04><02><01>fd<03> }|S)a<>Decorate a view function to register it with the given URL
rule and options. Calls :meth:`add_url_rule`, which has more
details about the implementation.
.. code-block:: python
@app.route("/")
def index():
return "Hello, World!"
See :ref:`url-route-registrations`.
The endpoint name for the route defaults to the name of the view
function if the ``endpoint`` parameter isn't passed.
The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` and
``OPTIONS`` are added automatically.
:param rule: The URL rule string.
:param options: Extra options passed to the
:class:`~werkzeug.routing.Rule` object.
rrc<00>T<00><03><00><02>dd<00><00>}<00>j<00>||fi<00><02><01>|S)N<>endpoint)<02>pop<6F> add_url_rule)rr<>r}r|r$s <20><><EFBFBD>r&<00> decoratorz!Scaffold.route.<locals>.decorator<6F>s:<00><><00><1E>{<7B>{<7B>:<3A>t<EFBFBD>4<>4<>H<EFBFBD> <1D>D<EFBFBD> <1D>d<EFBFBD>H<EFBFBD>a<EFBFBD> ;<3B> ;<3B>7<EFBFBD> ;<3B> ;<3B> ;<3B><14>Hr()r)r$r|r}r<>s``` r&r<>zScaffold.route<74>sC<00><><EFBFBD><EFBFBD><00>2 <15><17> <15>W<EFBFBD> <15> <15> <15> <15> <15> <15> <15> <15>
<19>r(r<><00> view_func<6E>provide_automatic_optionsc <00><00>t<00>)a;Register a rule for routing incoming requests and building
URLs. The :meth:`route` decorator is a shortcut to call this
with the ``view_func`` argument. These are equivalent:
.. code-block:: python
@app.route("/")
def index():
...
.. code-block:: python
def index():
...
app.add_url_rule("/", view_func=index)
See :ref:`url-route-registrations`.
The endpoint name for the route defaults to the name of the view
function if the ``endpoint`` parameter isn't passed. An error
will be raised if a function has already been registered for the
endpoint.
The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` is
always added automatically, and ``OPTIONS`` is added
automatically by default.
``view_func`` does not necessarily need to be passed, but if the
rule should participate in routing an endpoint name must be
associated with a view function at some point with the
:meth:`endpoint` decorator.
.. code-block:: python
app.add_url_rule("/", endpoint="index")
@app.endpoint("index")
def index():
...
If ``view_func`` has a ``required_methods`` attribute, those
methods are added to the passed and automatic methods. If it
has a ``provide_automatic_methods`` attribute, it is used as the
default if the parameter is not passed.
:param rule: The URL rule string.
:param endpoint: The endpoint name to associate with the rule
and view function. Used when routing and building URLs.
Defaults to ``view_func.__name__``.
:param view_func: The view function to associate with the
endpoint name.
:param provide_automatic_options: Add the ``OPTIONS`` method and
respond to ``OPTIONS`` requests automatically.
:param options: Extra options passed to the
:class:`~werkzeug.routing.Rule` object.
rR)r$r|r<>r<>r<>r}s r&r<>zScaffold.add_url_rule<6C>s <00><00>D"<22>!r(c<00>4<00><00><01>dtdtf<04><01>fd<03> }|S)a<>Decorate a view function to register it for the given
endpoint. Used if a rule is added without a ``view_func`` with
:meth:`add_url_rule`.
.. code-block:: python
app.add_url_rule("/ex", endpoint="example")
@app.endpoint("example")
def example():
...
:param endpoint: The endpoint name to associate with the view
function.
rrc<00><00><02>|<00>j<00><|Sr")r@)rr<>r$s <20><>r&r<>z$Scaffold.endpoint.<locals>.decorators<00><><00>,-<2D>D<EFBFBD> <1F><08> )<29><14>Hr()r)r$r<>r<>s`` r&r<>zScaffold.endpoint
s=<00><><EFBFBD><00>$ <15><11> <15>q<EFBFBD> <15> <15> <15> <15> <15> <15> <15><19>r(rc<00>b<00>|j<00>dg<00><00><00>|<01><00>|S)a<>Register a function to run before each request.
For example, this can be used to open a database connection, or
to load the logged in user from the session.
.. code-block:: python
@app.before_request
def load_user():
if "user_id" in session:
g.user = db.session.get(session["user_id"])
The function will be called without any arguments. If it returns
a non-``None`` value, the value is handled as if it was the
return value from the view, and further request handling is
stopped.
This is available on both app and blueprint objects. When used on an app, this
executes before every request. When used on a blueprint, this executes before
every request that the blueprint handles. To register with a blueprint and
execute before every request, use :meth:`.Blueprint.before_app_request`.
N)rC<00>
setdefault<EFBFBD>append<6E>r$rs r&<00>before_requestzScaffold.before_request"s0<00><00>0 <0A>!<21>,<2C>,<2C>T<EFBFBD>2<EFBFBD>6<>6<>=<3D>=<3D>a<EFBFBD>@<40>@<40>@<40><10>r(c<00>b<00>|j<00>dg<00><00><00>|<01><00>|S)aWRegister a function to run after each request to this object.
The function is called with the response object, and must return
a response object. This allows the functions to modify or
replace the response before it is sent.
If a function raises an exception, any remaining
``after_request`` functions will not be called. Therefore, this
should not be used for actions that must execute, such as to
close resources. Use :meth:`teardown_request` for that.
This is available on both app and blueprint objects. When used on an app, this
executes after every request. When used on a blueprint, this executes after
every request that the blueprint handles. To register with a blueprint and
execute after every request, use :meth:`.Blueprint.after_app_request`.
N)rDr<>r<>r<>s r&<00> after_requestzScaffold.after_request=s0<00><00>$ <0A> <20>+<2B>+<2B>D<EFBFBD>"<22>5<>5<><<3C><<3C>Q<EFBFBD>?<3F>?<3F>?<3F><10>r(c<00>b<00>|j<00>dg<00><00><00>|<01><00>|S)aRegister a function to be called when the request context is
popped. Typically this happens at the end of each request, but
contexts may be pushed manually as well during testing.
.. code-block:: python
with app.test_request_context():
...
When the ``with`` block exits (or ``ctx.pop()`` is called), the
teardown functions are called just before the request context is
made inactive.
When a teardown function was called because of an unhandled
exception it will be passed an error object. If an
:meth:`errorhandler` is registered, it will handle the exception
and the teardown will not receive it.
Teardown functions must avoid raising exceptions. If they
execute code that might fail they must surround that code with a
``try``/``except`` block and log any errors.
The return values of teardown functions are ignored.
This is available on both app and blueprint objects. When used on an app, this
executes after every request. When used on a blueprint, this executes after
every request that the blueprint handles. To register with a blueprint and
execute after every request, use :meth:`.Blueprint.teardown_app_request`.
N)rEr<>r<>r<>s r&<00>teardown_requestzScaffold.teardown_requestRs0<00><00>> <0A>#<23>.<2E>.<2E>t<EFBFBD>R<EFBFBD>8<>8<>?<3F>?<3F><01>B<>B<>B<><10>r(c<00>F<00>|jd<00>|<01><00>|S)a#Registers a template context processor function. These functions run before
rendering a template. The keys of the returned dict are added as variables
available in the template.
This is available on both app and blueprint objects. When used on an app, this
is called for every rendered template. When used on a blueprint, this is called
for templates rendered from the blueprint's views. To register with a blueprint
and affect every template, use :meth:`.Blueprint.app_context_processor`.
N)rFr<>r<>s r&<00>context_processorzScaffold.context_processorts%<00><00> <0A>(<28><14>.<2E>5<>5<>a<EFBFBD>8<>8<>8<><10>r(c<00>F<00>|jd<00>|<01><00>|S)alRegister a URL value preprocessor function for all view
functions in the application. These functions will be called before the
:meth:`before_request` functions.
The function can modify the values captured from the matched url before
they are passed to the view. For example, this can be used to pop a
common language code value and place it in ``g`` rather than pass it to
every view.
The function is passed the endpoint name and values dict. The return
value is ignored.
This is available on both app and blueprint objects. When used on an app, this
is called for every request. When used on a blueprint, this is called for
requests that the blueprint handles. To register with a blueprint and affect
every request, use :meth:`.Blueprint.app_url_value_preprocessor`.
N)rGr<>r<>s r&<00>url_value_preprocessorzScaffold.url_value_preprocessor<6F>s%<00><00>, <0A>$<24>T<EFBFBD>*<2A>1<>1<>!<21>4<>4<>4<><10>r(c<00>F<00>|jd<00>|<01><00>|S)a<>Callback function for URL defaults for all view functions of the
application. It's called with the endpoint and values and should
update the values passed in place.
This is available on both app and blueprint objects. When used on an app, this
is called for every request. When used on a blueprint, this is called for
requests that the blueprint handles. To register with a blueprint and affect
every request, use :meth:`.Blueprint.app_url_defaults`.
N)rHr<>r<>s r&<00> url_defaultszScaffold.url_defaults<74>s%<00><00> <0A>"<22>4<EFBFBD>(<28>/<2F>/<2F><01>2<>2<>2<><10>r(<00>code_or_exceptionc<00>4<00><00><01>dtdtf<04><01>fd<03> }|S)a<>Register a function to handle errors by code or exception class.
A decorator that is used to register a function given an
error code. Example::
@app.errorhandler(404)
def page_not_found(error):
return 'This page does not exist', 404
You can also register handlers for arbitrary exceptions::
@app.errorhandler(DatabaseError)
def special_exception_handler(error):
return 'Database connection failed', 500
This is available on both app and blueprint objects. When used on an app, this
can handle errors from every request. When used on a blueprint, this can handle
errors from requests that the blueprint handles. To register with a blueprint
and affect every request, use :meth:`.Blueprint.app_errorhandler`.
.. versionadded:: 0.7
Use :meth:`register_error_handler` instead of modifying
:attr:`error_handler_spec` directly, for application wide error
handlers.
.. versionadded:: 0.7
One can now additionally also register custom exception types
that do not necessarily have to be a subclass of the
:class:`~werkzeug.exceptions.HTTPException` class.
:param code_or_exception: the code as integer for the handler, or
an arbitrary exception
rrc<00>4<00><02><00><02><00>|<00><00>|Sr")<01>register_error_handler)rr<>r$s <20><>r&r<>z(Scaffold.errorhandler.<locals>.decorator<6F>s<00><><00> <10> '<27> '<27>(9<>1<EFBFBD> =<3D> =<3D> =<3D><14>Hr()r)r$r<>r<>s`` r&<00> errorhandlerzScaffold.errorhandler<65>s><00><><EFBFBD><00>L <15><1F> <15>_<EFBFBD> <15> <15> <15> <15> <15> <15> <15><19>r(c<00>b<00>|<00>|<01><00>\}}||jd||<dS)z<>Alternative error attach function to the :meth:`errorhandler`
decorator that is more straightforward to use for non decorator
usage.
.. versionadded:: 0.7
N)<02>_get_exc_class_and_coderA)r$r<>r<00> exc_class<73>codes r&r<>zScaffold.register_error_handler<65>s9<00><00><1F>6<>6<>7H<37>I<>I<><0F> <09>4<EFBFBD>9:<3A><04><1F><04>%<25>d<EFBFBD>+<2B>I<EFBFBD>6<>6<>6r(<00>exc_class_or_codec<00>~<00>t|t<00><00>r1 t|}n$#t$rt d|<00>d<02><03><00>d<03>wxYw|}t|t
<00><00>rt |<01>d<04><02><00><00>t|t
<00><00>st d|j<00>d<05><03><00><00>t|t<00><00>r ||j
fS|dfS)a Get the exception class being handled. For HTTP status codes
or ``HTTPException`` subclasses, return both the exception and
status code.
:param exc_class_or_code: Any exception class, or an HTTP status
code as an integer.
<20>'z^' is not a recognized HTTP error code. Use a subclass of HTTPException with that code instead.Nzh is an instance, not a class. Handlers can only be registered for Exception classes or HTTP error codes.zl' is not a subclass of Exception. Handlers can only be registered for Exception classes or HTTP error codes.) rgrhr<00>KeyErrorrx<00> Exceptionr<6E><00>
issubclassr)rr<>)r<>r<>s r&r<>z Scaffold._get_exc_class_and_code<64>s<00><00> <16>'<27><13> -<2D> -<2D>
*<2A> <1C>.<2E>/@<40>A<> <09> <09><><1B> <1C> <1C> <1C> <20>*<2A>)<29>*<2A>*<2A>*<2A><12><12><1C> <1C> <1C><><EFBFBD><EFBFBD>*<2A>I<EFBFBD> <15>i<EFBFBD><19> +<2B> +<2B> <0E><1B><1C> <20> <20> <20><0E><0E> <0E> <1A>)<29>Y<EFBFBD>/<2F>/<2F> <0E><1C>(<28>I<EFBFBD>&<26>(<28>(<28>(<28><0E><0E> <0E> <16>i<EFBFBD><1D> /<2F> /<2F> #<23><1C>i<EFBFBD>n<EFBFBD>,<2C> ,<2C><1C>d<EFBFBD>?<3F> "s <00> %<00>A)NNNN)rr)NNN)Jr)<00>
__module__<EFBFBD> __qualname__<5F>__doc__rn<00>__annotations__r1r*<00>Optionalr2r3<00>Union<6F>Type<70>json<6F> JSONEncoderr4<00> JSONDecoderrU<00>PathLikerIrPr#<00>propertyr6<00>setter<65>boolr^r7rhrjrorrrq<00>IO<49>AnyStrrzr<<00>Callablerr<>r-r+r<>r<>r<>r<>r<>r<><00>ft<66> RouteCallabler<65>rr<>rr<>rr<>rr<>rr<>rr<>rr<>r<>rr<><00>ErrorHandlerCallabler<65><00> staticmethod<6F>Tupler<65>r=r(r&r/r/7s<00><00><00><00><00><00><00><08><08>" <0E>I<EFBFBD>I<EFBFBD>I<EFBFBD>&*<2A>N<EFBFBD>A<EFBFBD>J<EFBFBD>s<EFBFBD>O<EFBFBD>*<2A>*<2A>*<2A>(,<2C><14>a<EFBFBD>j<EFBFBD><13>o<EFBFBD>,<2C>,<2C>,<2C>=A<01>L<EFBFBD>!<21>'<27>!<21>&<26><14>!1<>2<>D<EFBFBD>8<>9<>@<40>@<40>@<40>=A<01>L<EFBFBD>!<21>'<27>!<21>&<26><14>!1<>2<>D<EFBFBD>8<>9<>@<40>@<40>@<40>
@D<01>+/<2F>AE<41>%)<29> R<1E>R<1E><18>R<1E><19>z<EFBFBD>!<21>'<27>#<23>r<EFBFBD>{<7B>*:<3A>";<3B><<3C>R<1E><1B><1A>C<EFBFBD><1F> R<1E>
<1B><1A>A<EFBFBD>G<EFBFBD>C<EFBFBD><12><1B>,<<3C>$=<3D>><3E> R<1E> <15>:<3A>c<EFBFBD>?<3F> R<1E>R<1E>R<1E>R<1E>h8<>#<23>8<>8<>8<>8<>"<22>C<EFBFBD>"<22>D<EFBFBD>"<22>"<22>"<22>"<22><0E><18>q<EFBFBD>z<EFBFBD>#<23><EFBFBD><18><18><18><0E>X<EFBFBD><18><13><19>$<24>1<EFBFBD>:<3A>a<EFBFBD>g<EFBFBD>c<EFBFBD>2<EFBFBD>;<3B>6F<36>.G<>#H<>$<24>T<EFBFBD>$<24>$<24>$<24><1A><19>$<24> <0E>.<2E>4<EFBFBD>.<2E>.<2E>.<2E><0E>X<EFBFBD>.<2E><0E> <14><11><1A>C<EFBFBD><1F> <14> <14> <14><0E>X<EFBFBD> <14><15><1B>&<26>Q<EFBFBD>Z<EFBFBD><03>_<EFBFBD>&<26><14>&<26>&<26>&<26><1C><1B>&<26> <15>a<EFBFBD>j<EFBFBD><13>o<EFBFBD><15>!<21>*<2A>S<EFBFBD>/<2F><15><15><15><15>0
<EFBFBD><13>
<EFBFBD><1A>
<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD>$<1C>
<18>a<EFBFBD>j<EFBFBD>)9<>:<3A>
<18>
<18>
<18><1C><1B>
<18>B<01>B<01>c<EFBFBD>B<01><13>B<01><01><04>Q<EFBFBD>X<EFBFBD><0E>B<01>B<01>B<01>B<01>. =<3D><13> =<3D><12> =<3D><16> =<3D>
<0B><1A>W<EFBFBD>I<EFBFBD>w<EFBFBD>&<26> '<27> =<3D> =<3D> =<3D> =<3D><11>8<><03>8<><01><05>8<>!<21>*<2A>g<EFBFBD>Y<EFBFBD><07>=O<>2P<32>8<>8<>8<><11>[<5B>8<><11>9<><13>9<><11><15>9<>1<EFBFBD>:<3A>w<EFBFBD>i<EFBFBD><17>>P<>3Q<33>9<>9<>9<><11>[<5B>9<><11>8<><03>8<><01><05>8<>!<21>*<2A>g<EFBFBD>Y<EFBFBD><07>=O<>2P<32>8<>8<>8<><11>[<5B>8<><11>;<3B>3<EFBFBD>;<3B>1<EFBFBD>5<EFBFBD>;<3B>Q<EFBFBD>Z<EFBFBD><17> <09>7<EFBFBD>@R<>5S<35>;<3B>;<3B>;<3B><11>[<5B>;<3B><11>:<3A>#<23>:<3A>!<21>%<25>:<3A>A<EFBFBD>J<EFBFBD><07>y<EFBFBD>'<27>?Q<>4R<34>:<3A>:<3A>:<3A><11>[<5B>:<3A><11><19>#<23><19>!<21>%<25><19>A<EFBFBD>J<EFBFBD><07>y<EFBFBD>'<27>?Q<>4R<34><19><19><19><11>[<5B><19>><11>%)<29>26<32>6:<3A> A"<22>A"<22><11>A"<22><14>*<2A>S<EFBFBD>/<2F>A"<22><15>:<3A>b<EFBFBD>.<2E>/<2F> A"<22>
$%<25>:<3A>d<EFBFBD>#3<> A"<22> <15>5<EFBFBD> A"<22>
<0E>A"<22>A"<22>A"<22><11>[<5B>A"<22>F<11><19><13><19><11><1A>Q<EFBFBD>C<EFBFBD><11>F<EFBFBD>);<3B><19><19><19><11>[<5B><19>.<11><11> 0<><11>5E<35><11><11><11><11>[<5B><11>4<11><11><EFBFBD><11>?<3F><11><11><11><11>[<5B><11>(<11><11>*<2A><11><1A><11><11><11><11>[<5B><11>B<11><11> '<27><11>
&<26><11><11><11><11>[<5B><11> <11><11> #<23><11>
"<22><11><11><11><11>[<5B><11>0<11> <11>n<EFBFBD> <11><1E> <11> <11> <11><11>[<5B> <11><11>)<19>!"<22><17><11><16> <09>):<3A>C<EFBFBD>)?<3F>!@<40>)<19>
<EFBFBD><1A>_<EFBFBD>%<25><EFBFBD>6<> 7<>)<19>)<19>)<19><11>[<5B>)<19>V<11> ;<3B><1C>7<EFBFBD>1<EFBFBD>6<EFBFBD>)<29>#4<>c<EFBFBD>#9<>:<3A> ;<3B> <0E> "<22> ;<3B>
<0E> ;<3B> ;<3B> ;<3B><11>[<5B> ;<3B><12>)#<23><1C>7<EFBFBD>1<EFBFBD>6<EFBFBD>)<29>#4<>c<EFBFBD>#9<>:<3A>)#<23>
<EFBFBD><17><11><16> <09>"<22>A<EFBFBD>J<EFBFBD>s<EFBFBD>O<EFBFBD>3<> 4<>)#<23>)#<23>)#<23><12>\<5C>)#<23>)#<23>)#r(r/r<>c<00>(<00>|<00>
Jd<02><00><00>|jS)zsInternal helper that returns the default endpoint for a given
function. This always is the function name.
Nz/expected view func if endpoint is not provided.)r))r<>s r&<00>_endpoint_from_view_funcr<63>s"<00><00> <15> <20> <20>"S<> <20> <20> <20> <14> <1D>r(c<00><><00>t|d<01><00>r|<00>|<01><00>St|<00><00>}|jdkr |jdkrdSt d|j<00>d<06><03><00><00>)z<>Attempt to figure out if the given name is a package or a module.
:param: loader: The loader that handled the name.
:param mod_name: The name of the package or module.
<20>
is_package<EFBFBD>_frozen_importlib<69>NamespaceLoaderTr<54>z<.is_package()' must be implemented for PEP 302 import hooks.)<06>hasattrr<72>rNr<>r)<00>AttributeError)<03>loader<65>mod_name<6D>clss r&<00>)_matching_loader_thinks_module_is_packager<65>s<><00><00><0F>v<EFBFBD>|<7C>$<24>$<24>+<2B><15> <20> <20><18>*<2A>*<2A>*<2A>
<0E>v<EFBFBD>,<2C>,<2C>C<EFBFBD> <0B>~<7E>,<2C>,<2C>,<2C><13><1C>AR<41>1R<31>1R<31><13>t<EFBFBD> <19> <1A>C<EFBFBD>L<EFBFBD> <1A> <1A> <1A> <06> <06>r(rV<00>basec<00>T<00> |<00>|<01><00>dS#t$rYdSwxYw)NTF)<02> relative_torx)rVr<>s r&<00>_path_is_relative_tor<6F>5sB<00><00><15> <0C><18><18><14><1E><1E><1E><13>t<EFBFBD><74> <15><15><15><15><14>u<EFBFBD>u<EFBFBD><15><><EFBFBD>s <00><00>
'<03>'c<00><><00><08>|<00>d<01><00>\}}} tj<00>|<01><00>}|<03>t d<03><00><00> |jdvr<>tj<00>|<00><00>}|<04>Q|jrJtjtj
<00> |j<00><00><00><00><00><08>fd<05>|jD<00><00>}nt|j<00><00>}tj
<00> t|<05><00><00><00>S|jrAtj
<00> tj
<00> |j<00><00><00><00>Stj
<00> |j<00><00>S#ttf$rYnwxYwt!j|<01><00>}|<06>|dkrtj<00><00>St'|d<07><00>r|<06>|<01><00>}n1t'|d<08><00>r|j}ntj|<01><00>j}tj
<00>tj
<00> |<07><00><00><00><00>t3||<01><00>rtj
<00> <00><08><00><00><08>S) z2Find the path that contains the package or module.<2E>.Nz not found>N<> namespacec3<00><<00>K<00>|]}t<00>|<01><00><00>|V<00><00>dSr")r<>)<03>.0<EFBFBD>location<6F> package_paths <20>r&<00> <genexpr>z%_find_package_path.<locals>.<genexpr>WsG<00><><00><00><00>$<12>$<12> <20>+<2B>L<EFBFBD>(<28>C<>C<>$<12><1C>$<12>$<12>$<12>$<12>$<12>$r(<00>__main__<5F> get_filename<6D>archive)<1A> partition<6F> importlib<69>util<69> find_specrx<00>origin<69>submodule_search_locations<6E>pathlib<69>PathrUrV<00>
commonpath<EFBFBD>iter<65>dirname<6D>next<78> ImportError<6F>pkgutil<69>
get_loader<EFBFBD>getcwdr<64>r<>r<><00> import_module<6C>__file__<5F>abspathr<68>) r5<00> root_mod_name<6D>_<> root_spec<65> package_spec<65>search_locationsr<73>rcr<>s @r&<00>_find_package_pathr>sN<00><><00>%<25>/<2F>/<2F><03>4<>4<><17>M<EFBFBD>1<EFBFBD>a<EFBFBD>#5<><1D>N<EFBFBD>,<2C>,<2C>]<5D>;<3B>;<3B> <09> <14> <1C><1C>[<5B>)<29>)<29> )<29> <1D> <15> <1B>2<> 2<> 2<>$<24>><3E>3<>3<>K<EFBFBD>@<40>@<40>L<EFBFBD><1B>'<27>L<EFBFBD>,S<>'<27>&<26>|<7C><16>G<EFBFBD>&<26>&<26>|<7C>'N<>O<>O<> <12> <12> <0C>$<12>$<12>$<12>$<12>$-<2D>$H<>$<12>$<12>$<12> <20> <20>$(<28> <09>(L<>#M<>#M<> <20><15>7<EFBFBD>?<3F>?<3F>4<EFBFBD>(8<>#9<>#9<>:<3A>:<3A> :<3A> <16> 1<> 5<><15>7<EFBFBD>?<3F>?<3F>2<EFBFBD>7<EFBFBD>?<3F>?<3F>9<EFBFBD>3C<33>#D<>#D<>E<>E<> E<><16>7<EFBFBD>?<3F>?<3F>9<EFBFBD>#3<>4<>4<> 4<><34>3 <18><1A> $<24> <0A> <0A> <0A> <0C><04> <0A><><EFBFBD><EFBFBD>8<15> <1F> <0A> .<2E> .<2E>F<EFBFBD> <0A>~<7E><1D>*<2A>4<>4<><11>y<EFBFBD>{<7B>{<7B><1A><0E>v<EFBFBD>~<7E>&<26>&<26>C<01><19>&<26>&<26>}<7D>5<>5<><08><08> <10><16><19> #<23> #<23>C<01><19>><3E><08><08><1D>*<2A>=<3D>9<>9<>B<><08><15>7<EFBFBD>?<3F>?<3F>2<EFBFBD>7<EFBFBD>?<3F>?<3F>8<EFBFBD>#<<3C>#<<3C>=<3D>=<3D>L<EFBFBD>1<><16><1D>G<>G<>5<><19>w<EFBFBD><EFBFBD><EFBFBD>|<7C>4<>4<> <0C> <17>s<00>0E4<00>4F<03>Fr5c<00>j<00>t|<00><00>}tj<00>tj<00><00>}t tj|<01><00>|<02><00>r||fStj<00> |<01><00>\}}|<04>
<00><00>dkr<>tj<00> |<03><00>\}}|<06>
<00><00>dkr||fStj<00> |<05><00><00>
<00><00>dkr!tj<00> |<05><00>|fS||fSd|fS)aFind the prefix that a package is installed under, and the path
that it would be imported from.
The prefix is the directory containing the standard directory
hierarchy (lib, bin, etc.). If the package is not installed to the
system (:attr:`sys.prefix`) or a virtualenv (``site-packages``),
``None`` is returned.
The path is the entry in :attr:`sys.path` that contains the package
for import. If the package is not installed, it's assumed that the
package was imported from the current working directory.
z site-packages<65>libN) rrUrVr<00>sys<79>prefixr<78>r<><00>PurePath<74>split<69>lowerrar<>)r5r<><00> py_prefix<69> site_parent<6E> site_folder<65>parent<6E>folders r&<00> find_packager<00>s<00><00>&<26>k<EFBFBD>2<>2<>L<EFBFBD><12><07><0F><0F><03>
<EFBFBD>+<2B>+<2B>I<EFBFBD><1C>G<EFBFBD>,<2C>\<5C>:<3A>:<3A>I<EFBFBD>F<>F<>'<27><18>,<2C>&<26>&<26>!<21>w<EFBFBD>}<7D>}<7D>\<5C>:<3A>:<3A><1C>K<EFBFBD><1B><13><18><18><1A><1A>o<EFBFBD>-<2D>-<2D><1B><17><1D><1D>{<7B>3<>3<><0E><06><06> <12><<3C><<3C>><3E>><3E>U<EFBFBD> "<22> "<22><19><<3C>'<27> '<27> <0E>7<EFBFBD> <1B> <1B>F<EFBFBD> #<23> #<23> )<29> )<29> +<2B> +<2B>u<EFBFBD> 4<> 4<><15>7<EFBFBD>?<3F>?<3F>6<EFBFBD>*<2A>*<2A>L<EFBFBD>8<> 8<><1B>L<EFBFBD>(<28>(<28> <10><1C> <1D>r()C<>importlib.utilr<6C>r<>rUr<>r<>r
r
r*<00> collectionsr<00>datetimer<00> functoolsr<00>jinja2r<00>werkzeug.exceptionsrr<00>r<>r?r <00>globalsr <00>helpersr rr<00>
templatingr<00> TYPE_CHECKING<4E>wrappersr<00>object<63> _sentinel<65>TypeVarr<72>r+r<00>AfterRequestCallabler<00>BeforeRequestCallablerr<>r<00>TeardownCallabler<00> TemplateContextProcessorCallabler<00>URLDefaultCallabler<00>URLValuePreprocessorCallablerr<>rr-r/rnr<>r<>r r<>r<>rrr=r(r&<00><module>r*sK<00><01><15><15><15><15> <0B> <0B> <0B> <0B> <09> <09> <09> <09><0E><0E><0E><0E><0E><0E><0E><0E>
<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD><12><12><12><12>#<23>#<23>#<23>#<23>#<23>#<23><1E><1E><1E><1E><1E><1E>$<24>$<24>$<24>$<24>$<24>$<24>#<23>#<23>#<23>#<23>#<23>#<23>2<>2<>2<>2<>2<>2<>-<2D>-<2D>-<2D>-<2D>-<2D>-<2D><1A><1A><1A><1A><1A><1A><19><19><19><19><19><19> <20> <20> <20> <20> <20> <20>"<22>"<22>"<22>"<22>"<22>"<22>+<2B>+<2B>+<2B>+<2B>+<2B>+<2B>(<28>(<28>(<28>(<28>(<28>(<28>7<>7<>7<>7<>7<>7<><04>?<3F>#<23>"<22>"<22>"<22>"<22>"<22>"<22> <13>F<EFBFBD>H<EFBFBD>H<EFBFBD> <09> <0A>A<EFBFBD>I<EFBFBD>c<EFBFBD><11><1A>C<EFBFBD><11><15>J<EFBFBD>/<2F>0<>0<>0<><01><1B>!<21>)<29>-<2D>R<EFBFBD>5L<35>M<>M<>M<><0F><1C>1<EFBFBD>9<EFBFBD>/<2F>r<EFBFBD>7O<37>P<>P<>P<><10><1B>!<21>)<29>-<2D>R<EFBFBD>5L<35>M<>M<>M<><0F> <16>Q<EFBFBD>Y<EFBFBD>|<7C>2<EFBFBD>+><3E> ?<3F> ?<3F> ?<3F>
<EFBFBD>(<28>q<EFBFBD>y<EFBFBD>"<22>"<22>*M<> <02> <02> <02><1C><1B><11><19>+<2B>2<EFBFBD>3H<33>I<>I<>I<><0E>$<24>1<EFBFBD>9<EFBFBD><1E>b<EFBFBD>&E<><02><02><02><18> <14>!<21>)<29>I<EFBFBD>R<EFBFBD>%5<>
6<EFBFBD>
6<EFBFBD>
6<EFBFBD><07>6<>1<EFBFBD>6<><11>6<>6<>6<>6<>Z #<23>Z #<23>Z #<23>Z #<23>Z #<23>Z #<23>Z #<23>Z #<23>z<1E><01>
<EFBFBD><1E>s<EFBFBD><1E><1E><1E><1E><06><06><06>2<15>w<EFBFBD>/<2F><15>s<EFBFBD><15>t<EFBFBD><15><15><15><15>A<18>A<18>A<18>H&<1E>c<EFBFBD>&<1E>&<1E>&<1E>&<1E>&<1E>&r(