Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/werkzeug/__pycache__/exceptions.cpython-37.pyc

343 lines
25 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F>]<5D>[<00>@s<>dZddlZddlmZddlmZddlmZddlmZddlmZdd l m
Z
eGd
d <0B>d e <0B><03>Z Gd d <0A>d e <0C>Z Gdd<0F>de <0A>ZGdd<11>de <0A>ZGdd<13>de <0A>ZGdd<15>de <0C>ZGdd<17>de <0C>ZGdd<19>de <0C>ZGdd<1B>de <0C>ZGdd<1D>de <0C>ZGdd<1F>de <0C>ZGd d!<21>d!e <0C>ZGd"d#<23>d#e <0C>ZGd$d%<25>d%e <0C>ZGd&d'<27>d'e <0C>ZGd(d)<29>d)e <0C>ZGd*d+<2B>d+e <0C>ZGd,d-<2D>d-e <0C>ZGd.d/<2F>d/e <0C>ZGd0d1<64>d1e <0C>ZGd2d3<64>d3e <0C>Z Gd4d5<64>d5e <0C>Z!Gd6d7<64>d7e <0C>Z"Gd8d9<64>d9e <0C>Z#Gd:d;<3B>d;e <0C>Z$Gd<d=<3D>d=e <0C>Z%Gd>d?<3F>d?e <0C>Z&Gd@dA<64>dAe <0C>Z'GdBdC<64>dCe <0C>Z(GdDdE<64>dEe <0C>Z)GdFdG<64>dGe <0C>Z*GdHdI<64>dIe <0C>Z+GdJdK<64>dKe <0C>Z,GdLdM<64>dMe <0C>Z-iZ.d gZ/dNdO<64>Z0e0<65>[0GdPdQ<64>dQe1<65>Z2dRdS<64>Z3e2<65>Z4e <0A>5e6<65>Z7dS)Ta<54>
werkzeug.exceptions
~~~~~~~~~~~~~~~~~~~
This module implements a number of Python exceptions you can raise from
within your views to trigger a standard non-200 response.
Usage Example
-------------
::
from werkzeug.wrappers import BaseRequest
from werkzeug.wsgi import responder
from werkzeug.exceptions import HTTPException, NotFound
def view(request):
raise NotFound()
@responder
def application(environ, start_response):
request = BaseRequest(environ)
try:
return view(request)
except HTTPException as e:
return e
As you can see from this example those exceptions are callable WSGI
applications. Because of Python 2.4 compatibility those do not extend
from the response objects but only from the python exception class.
As a matter of fact they are not Werkzeug response objects. However you
can get a response object by calling ``get_response()`` on a HTTP
exception.
Keep in mind that you have to pass an environment to ``get_response()``
because some errors fetch additional information from the WSGI
environment.
If you want to hook in a different exception page to say, a 404 status
code, you can add a second except for a specific subclass of an error::
@responder
def application(environ, start_response):
request = BaseRequest(environ)
try:
return view(request)
except NotFound, e:
return not_found(request)
except HTTPException, e:
return e
:copyright: 2007 Pallets
:license: BSD-3-Clause
<EFBFBD>N<>)<01>implements_to_string)<01> integer_types)<01> iteritems)<01> text_type)<01> _get_environ)<01>escapecs<>eZdZdZdZdZd<17>fdd<04> Zeddd<06><01>Ze dd<08><00>Z
dd d
<EFBFBD>Z dd d <0C>Z dd d<0E>Z ddd<10>Zdd<12>Zdd<14>Zdd<16>Z<11>ZS)<1D> HTTPExceptionz<6E>Baseclass for all HTTP exceptions. This exception can be called as WSGI
application to render a default error page or you can catch the subclasses
of it independently and render nicer error messages.
Ncs&tt|<00><02><02>|dk r||_||_dS)N)<05>superr <00>__init__<5F> description<6F>response)<03>selfr r )<01> __class__<5F><00>9/tmp/pip-install-c3kgu56x/Werkzeug/werkzeug/exceptions.pyr PszHTTPException.__init__csLG<00><00>fdd<02>d<02><00><01>}t<00>d<03>j<02>d<04>|_|p:<3A>j<05>j}||_|_|S)a<>Create an exception that is a subclass of the calling HTTP
exception and the ``exception`` argument.
The first argument to the class will be passed to the
wrapped ``exception``, the rest to the HTTP exception. If
``e.args`` is not empty and ``e.show_exception`` is ``True``,
the wrapped exception message is added to the HTTP error
description.
.. versionchanged:: 0.15.5
The ``show_exception`` attribute controls whether the
description includes the wrapped exception message.
.. versionchanged:: 0.15.0
The description includes the wrapped exception message.
csJeZdZ<02>jZdZd<08><00><01>fdd<04> Ze<07>fdd<06><08>Zejdd<06><00>Z<03>Z S) z"HTTPException.wrap.<locals>.newclsFNcs6t<00>|<00>j||<03>|dkr&<26><02>|<00>n <0C><02>||<01>dS)N)r
r )r<00>arg<72>args<67>kwargs)r<00>cls<6C> exceptionrrr ms z+HTTPException.wrap.<locals>.newcls.__init__cs$|jrd<01>|j<02>j<03><00>|<00><01>S|jS)Nz {}
{}: {})<05>show_exception<6F>format<61> _description<6F>__name__<5F>__str__)r)rrrr usz.HTTPException.wrap.<locals>.newcls.descriptioncSs
||_dS)N)r)r<00>valuerrrr ~s)N)
r<00>
__module__<EFBFBD> __qualname__r rrr <00>property<74>setter<65> __classcell__r)rr)rr<00>newclsis
 r"rr)<07>sys<79> _getframe<6D> f_globals<6C>getrrr)rr<00>namer"r)rrr<00>wrapVs
 zHTTPException.wrapcCsddlm}|<01>|jd<03>S)zThe status name.r)<01>HTTP_STATUS_CODESz Unknown Error)<04>httpr)r&<00>code)rr)rrrr'<00>s zHTTPException.namecCsdt|j<01><01>dd<03>S)zGet the description.z <p>%s</p><3E>
z<br>)rr <00>replace)r<00>environrrr<00>get_description<6F>szHTTPException.get_descriptioncCs"td|jt|j<03>|<00>|<01>d<02><00>S)zGet the HTML body.z{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>%(code)s %(name)s</title>
<h1>%(name)s</h1>
%(description)s
)r+r'r )rr+rr'r/)rr.rrr<00>get_body<64>s
zHTTPException.get_bodycCsdgS)zGet a list of headers.)z Content-Typez text/htmlr)rr.rrr<00> get_headers<72>szHTTPException.get_headerscCsJddlm}|jdk r|jS|dk r,t|<01>}|<00>|<01>}||<00>|<01>|j|<03>S)ahGet a response object. If one was passed to the exception
it's returned directly.
:param environ: the optional environ for the request. This
can be used to modify the response depending
on how the request looked like.
:return: a :class:`Response` object or a subclass thereof.
r)<01>ResponseN)Zwrappers.responser2r rr1r0r+)rr.r2<00>headersrrr<00> get_response<73>s 

zHTTPException.get_responsecCs|<00>|<01>}|||<02>S)z<>Call the exception as WSGI application.
:param environ: the WSGI environment.
:param start_response: the response callable provided by the WSGI
server.
)r4)rr.Zstart_responser rrr<00>__call__<5F>s
zHTTPException.__call__cCs&|jdk r|jnd}d||j|jfS)Nz???z %s %s: %s)r+r'r )rr+rrrr<00>szHTTPException.__str__cCs(|jdk r|jnd}d|jj||jfS)Nz???z <%s '%s: %s'>)r+rrr')rr+rrr<00>__repr__<5F>szHTTPException.__repr__)NN)N)N)N)N)N)rrr<00>__doc__r+r r <00> classmethodr(rr'r/r0r1r4r5rr6r!rr)rrr Fs 0 




r c@seZdZdZdZdZdS)<05>
BadRequestz<EFBFBD>*400* `Bad Request`
Raise if the browser sends something to the application the application
or server cannot handle.
i<>zLThe browser (or proxy) sent a request that this server could not understand.N)rrrr7r+r rrrrr9<00>sr9c@seZdZdZdS)<03>ClientDisconnecteda)Internal exception that is raised if Werkzeug detects a disconnected
client. Since the client is already gone at that point attempting to
send the error message to the client might not work and might ultimately
result in another exception in the server. Mainly this is here so that
it is silenced by default as far as Werkzeug is concerned.
Since disconnections cannot be reliably detected and are unspecified
by WSGI to a large extent this might or might not be raised if a client
is gone.
.. versionadded:: 0.8
N)rrrr7rrrrr:<00>s r:c@seZdZdZdS)<03> SecurityErrorz<72>Raised if something triggers a security error. This is otherwise
exactly like a bad request error.
.. versionadded:: 0.9
N)rrrr7rrrrr;<00>sr;c@seZdZdZdS)<03>BadHostzSRaised if the submitted host is badly formatted.
.. versionadded:: 0.11.2
N)rrrr7rrrrr<<00>sr<c@s,eZdZdZdZdZd dd<06>Zd
dd<08>ZdS) <0B> Unauthorizeda<64>*401* ``Unauthorized``
Raise if the user is not authorized to access a resource.
The ``www_authenticate`` argument should be used to set the
``WWW-Authenticate`` header. This is used for HTTP basic auth and
other schemes. Use :class:`~werkzeug.datastructures.WWWAuthenticate`
to create correctly formatted values. Strictly speaking a 401
response is invalid if it doesn't provide at least one value for
this header, although real clients typically don't care.
:param description: Override the default message used for the body
of the response.
:param www-authenticate: A single value, or list of values, for the
WWW-Authenticate header.
.. versionchanged:: 0.15.3
If the ``www_authenticate`` argument is not set, the
``WWW-Authenticate`` header is not set.
.. versionchanged:: 0.15.3
The ``response`` argument was restored.
.. versionchanged:: 0.15.1
``description`` was moved back as the first argument, restoring
its previous position.
.. versionchanged:: 0.15.0
``www_authenticate`` was added as the first argument, ahead of
``description``.
i<>z<>The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.NcCs4t<00>|||<02>|dk r*t|ttf<02>s*|f}||_dS)N)r r <00>
isinstance<EFBFBD>tuple<6C>list<73>www_authenticate)rr r rArrrr s
zUnauthorized.__init__cCs6t<00>||<01>}|jr2|<02>dd<02>dd<04>|jD<00><01>f<02>|S)NzWWW-Authenticatez, cSsg|] }t|<01><01>qSr)<01>str)<02>.0<EFBFBD>xrrr<00>
<listcomp>-sz,Unauthorized.get_headers.<locals>.<listcomp>)r r1rA<00>append<6E>join)rr.r3rrrr1)s
 zUnauthorized.get_headers)NNN)N)rrrr7r+r r r1rrrrr=<00>s

r=c@seZdZdZdZdZdS)<05> Forbiddenz*403* `Forbidden`
Raise if the user doesn't have the permission for the requested resource
but was authenticated.
i<>zzYou don't have the permission to access the requested resource. It is either read-protected or not readable by the server.N)rrrr7r+r rrrrrH2srHc@seZdZdZdZdZdS)<05>NotFoundzQ*404* `Not Found`
Raise if a resource does not exist and never existed.
i<>zxThe requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.N)rrrr7r+r rrrrrIAsrIc@s,eZdZdZdZdZd dd<06>Zd
dd<08>ZdS) <0B>MethodNotAlloweda<64>*405* `Method Not Allowed`
Raise if the server used a method the resource does not handle. For
example `POST` if the resource is view only. Especially useful for REST.
The first argument for this exception should be a list of allowed methods.
Strictly speaking the response would be invalid if you don't provide valid
methods in the header which you can do with that list.
i<>z0The method is not allowed for the requested URL.NcCst<00>||<02>||_dS)zkTakes an optional list of valid http methods
starting with werkzeug 0.3 the list will be mandatory.N)r r <00> valid_methods)rrKr rrrr \s zMethodNotAllowed.__init__cCs,t<00>||<01>}|jr(|<02>dd<02>|j<02>f<02>|S)NZAllowz, )r r1rKrFrG)rr.r3rrrr1bs zMethodNotAllowed.get_headers)NN)N)rrrr7r+r r r1rrrrrJNs
 
rJc@seZdZdZdZdZdS)<05> NotAcceptablez<65>*406* `Not Acceptable`
Raise if the server can't return any content conforming to the
`Accept` headers of the client.
i<>z<>The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.N)rrrr7r+r rrrrrLisrLc@seZdZdZdZdZdS)<05>RequestTimeoutz?*408* `Request Timeout`
Raise to signalize a timeout.
i<>zqThe server closed the network connection because the browser didn't finish the request within the specified time.N)rrrr7r+r rrrrrMzsrMc@seZdZdZdZdZdS)<05>Conflictz<74>*409* `Conflict`
Raise to signal that a request cannot be completed because it conflicts
with the current state on the server.
.. versionadded:: 0.7
i<>z~A conflict happened while processing the request. The resource might have been modified while the request was being processed.N)rrrr7r+r rrrrrN<00>srNc@seZdZdZdZdZdS)<05>Goneza*410* `Gone`
Raise if a resource existed previously and went away without new location.
i<>z<>The requested URL is no longer available on this server and there is no forwarding address. If you followed a link from a foreign page, please contact the author of this page.N)rrrr7r+r rrrrrO<00>srOc@seZdZdZdZdZdS)<05>LengthRequiredz<64>*411* `Length Required`
Raise if the browser submitted data but no ``Content-Length`` header which
is required for the kind of processing the server does.
i<>zOA request with this method requires a valid <code>Content-Length</code> header.N)rrrr7r+r rrrrrP<00>srPc@seZdZdZdZdZdS)<05>PreconditionFailedz<64>*412* `Precondition Failed`
Status code used in combination with ``If-Match``, ``If-None-Match``, or
``If-Unmodified-Since``.
i<>zGThe precondition on the request for the URL failed positive evaluation.N)rrrr7r+r rrrrrQ<00>srQc@seZdZdZdZdZdS)<05>RequestEntityTooLargez~*413* `Request Entity Too Large`
The status code one should return if the data submitted exceeded a given
limit.
i<>z6The data value transmitted exceeds the capacity limit.N)rrrr7r+r rrrrrR<00>srRc@seZdZdZdZdZdS)<05>RequestURITooLargezI*414* `Request URI Too Large`
Like *413* but for too long URLs.
i<>zlThe length of the requested URL exceeds the capacity limit for this server. The request cannot be processed.N)rrrr7r+r rrrrrS<00>srSc@seZdZdZdZdZdS)<05>UnsupportedMediaTypez<65>*415* `Unsupported Media Type`
The status code returned if the server is unable to handle the media type
the client transmitted.
i<>zFThe server does not support the media type transmitted in the request.N)rrrr7r+r rrrrrT<00>srTc@s,eZdZdZdZdZd
dd<07>Zd dd <09>ZdS) <0C>RequestedRangeNotSatisfiablez~*416* `Requested Range Not Satisfiable`
The client asked for an invalid part of the file.
.. versionadded:: 0.7
i<>z.The server cannot provide the requested range.N<>bytescCst<00>||<03>||_||_dS)z^Takes an optional `Content-Range` header value based on ``length``
parameter.
N)r r <00>length<74>units)rrWrXr rrrr <00>s z%RequestedRangeNotSatisfiable.__init__cCs4t<00>||<01>}|jdk r0|<02>dd|j|jff<02>|S)Nz Content-Rangez%s */%d)r r1rWrFrX)rr.r3rrrr1<00>s 
z(RequestedRangeNotSatisfiable.get_headers)NrVN)N)rrrr7r+r r r1rrrrrU<00>s

rUc@seZdZdZdZdZdS)<05>ExpectationFailedz<64>*417* `Expectation Failed`
The server cannot meet the requirements of the Expect request-header.
.. versionadded:: 0.7
i<>z?The server could not meet the requirements of the Expect headerN)rrrr7r+r rrrrrYsrYc@seZdZdZdZdZdS)<05> ImATeapotz<74>*418* `I'm a teapot`
The server should return this if it is a teapot and someone attempted
to brew coffee with it.
.. versionadded:: 0.7
i<>z-This server is a teapot, not a coffee machineN)rrrr7r+r rrrrrZ srZc@seZdZdZdZdZdS)<05>UnprocessableEntityz|*422* `Unprocessable Entity`
Used if the request is well formed, but the instructions are otherwise
incorrect.
i<>zQThe request was well-formed but was unable to be followed due to semantic errors.N)rrrr7r+r rrrrr[sr[c@seZdZdZdZdZdS)<05>LockedzO*423* `Locked`
Used if the resource that is being accessed is locked.
i<>z.The resource that is being accessed is locked.N)rrrr7r+r rrrrr\'sr\c@seZdZdZdZdZdS)<05>FailedDependencyz<79>*424* `Failed Dependency`
Used if the method could not be performed on the resource
because the requested action depended on another action and that action failed.
i<>z<>The method could not be performed on the resource because the requested action depended on another action and that action failed.N)rrrr7r+r rrrrr]1sr]c@seZdZdZdZdZdS)<05>PreconditionRequireda*428* `Precondition Required`
The server requires this request to be conditional, typically to prevent
the lost update problem, which is a race condition between two or more
clients attempting to update a resource through PUT or DELETE. By requiring
each client to include a conditional header ("If-Match" or "If-Unmodified-
Since") with the proper value retained from a recent GET request, the
server ensures that each client has at least seen the previous revision of
the resource.
i<>zZThis request is required to be conditional; try using "If-Match" or "If-Unmodified-Since".N)rrrr7r+r rrrrr^@s
r^c@seZdZdZdZdZdS)<05>TooManyRequestsa]*429* `Too Many Requests`
The server is limiting the rate at which this user receives responses, and
this request exceeds that rate. (The server may use any convenient method
to identify users and their request rates). The server may include a
"Retry-After" header to indicate how long the user should wait before
retrying.
i<>zBThis user has exceeded an allotted request count. Try again later.N)rrrr7r+r rrrrr_Ssr_c@seZdZdZdZdZdS)<05>RequestHeaderFieldsTooLargez<65>*431* `Request Header Fields Too Large`
The server refuses to process the request because the header fields are too
large. One or more individual fields may be too large, or the set of all
headers is too large.
i<>z3One or more header fields exceeds the maximum size.N)rrrr7r+r rrrrr`asr`c@seZdZdZdZdZdS)<05>UnavailableForLegalReasonsz<73>*451* `Unavailable For Legal Reasons`
This status code indicates that the server is denying access to the
resource as a consequence of a legal demand.
i<>zUnavailable for legal reasons.N)rrrr7r+r rrrrramsrac@seZdZdZdZdZdS)<05>InternalServerErrorz<72>*500* `Internal Server Error`
Raise if an internal server error occurred. This is a good fallback if an
unknown error occurred in the dispatcher.
i<>z<>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.N)rrrr7r+r rrrrrbxsrbc@seZdZdZdZdZdS)<05>NotImplementedzt*501* `Not Implemented`
Raise if the application does not support the action requested by the
browser.
i<>z@The server does not support the action requested by the browser.N)rrrr7r+r rrrrrc<00>srcc@seZdZdZdZdZdS)<05>
BadGatewayz<EFBFBD>*502* `Bad Gateway`
If you do proxying in your application you should return this status code
if you received an invalid response from the upstream server it accessed
in attempting to fulfill the request.
i<>zFThe proxy server received an invalid response from an upstream server.N)rrrr7r+r rrrrrd<00>srdc@seZdZdZdZdZdS)<05>ServiceUnavailablezl*503* `Service Unavailable`
Status code you should return if a service is temporarily unavailable.
i<>z<>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.N)rrrr7r+r rrrrre<00>srec@seZdZdZdZdZdS)<05>GatewayTimeoutzt*504* `Gateway Timeout`
Status code you should return if a connection to an upstream server
times out.
i<>z/The connection to an upstream server timed out.N)rrrr7r+r rrrrrf<00>srfc@seZdZdZdZdZdS)<05>HTTPVersionNotSupportedzw*505* `HTTP Version Not Supported`
The server does not support the HTTP protocol version used in the request.
i<>zJThe server does not support the HTTP protocol version used in the request.N)rrrr7r+r rrrrrg<00>srgc Cs<>x<>tt<01><00>D]x\}}yt|t<03>}Wntk
r:d}YnX|r |jdkrLq t<06>|j<08>t <09>
|jd<00>}|dk rzt||<03>rzq |t |j<q WdS)NF) r<00>globals<6C>
issubclassr <00> TypeErrorr+<00>__all__rFr<00>default_exceptionsr&)<04>_name<6D>objZis_http_exceptionZold_objrrr<00>_find_exceptions<6E>s
 roc@s"eZdZdZddd<04>Zdd<06>ZdS)<08>AborteraYWhen passed a dict of code -> exception items it can be used as
callable that raises exceptions. If the first argument to the
callable is an integer it will be looked up in the mapping, if it's
a WSGI application it will be raised in a proxy exception.
The rest of the arguments are forwarded to the exception constructor.
NcCs.|dkr t}t|<01>|_|dk r*|j<02>|<02>dS)N)rl<00>dict<63>mapping<6E>update)rrr<00>extrarrrr <00>s

zAborter.__init__cOsF|s|st|t<01>st|d<01><01>||jkr2td|<00><01>|j|||<03><01>dS)N)r zno exception for %r)r>rr rr<00> LookupError)rr+rrrrrr5<00>s


 zAborter.__call__)NN)rrrr7r r5rrrrrp<00>s
rpcOst|f|<01>|<02>S)a<>Raises an :py:exc:`HTTPException` for the given status code or WSGI
application::
abort(404) # 404 Not Found
abort(Response('Hello World'))
Can be passed a WSGI application or a status code. If a status code is
given it's looked up in the list of exceptions and will raise that
exception, if passed a WSGI application it will wrap it in a proxy WSGI
exception and raise that::
abort(404)
abort(Response('Hello World'))
)<01>_aborter)<03>statusrrrrr<00>abort<72>srx)8r7r#<00>_compatrrrr<00> _internalr<00>utilsr<00> Exceptionr r9r:r;r<r=rHrIrJrLrMrNrOrPrQrRrSrTrUrYrZr[r\r]r^r_r`rarbrcrdrerfrgrlrkro<00>objectrprxrvr(<00>KeyErrorZBadRequestKeyErrorrrrr<00><module>;sh       ;