U )._K@sdZddlZddlmZddlmZddlmZddlmZddl m Z dd l m Z Gd d d e eZeGd d d ee ZGddde ZddZddZddZddZdS)z flask.debughelpers ~~~~~~~~~~~~~~~~~~ Various helpers to make the development experience better. :copyright: 2010 Pallets :license: BSD-3-Clause N)warn)implements_to_string) text_type)Flask) Blueprint)_request_ctx_stackc@seZdZdZdS)UnexpectedUnicodeErrorzjRaised in places where we want some better error reporting for unexpected unicode or binary data. N)__name__ __module__ __qualname____doc__rrC:\Users\Miouzora\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\flask/debughelpers.pyr sr c@s eZdZdZddZddZdS)DebugFilesKeyErrorzRaised from request.files during debugging. The idea is that it can provide a better error message than just a generic KeyError/BadRequest. cCsN|j|}d||jfg}|r>|dddd|Dd||_dS)Na%You tried to access the file "%s" in the request.files dictionary but it does not exist. The mimetype for the request is "%s" instead of "multipart/form-data" which means that no file contents were transmitted. To fix this error you should provide enctype="multipart/form-data" in your form.zI The browser instead transmitted some file names. This was submitted: %sz, css|]}d|VqdS)z"%s"Nr.0xrrr .sz.DebugFilesKeyError.__init__..)formgetlistmimetypeappendjoinmsg)selfrequestkeyZ form_matchesbufrrr__init__!s zDebugFilesKeyError.__init__cCs|jSN)r)rrrr__str__2szDebugFilesKeyError.__str__N)r r r r r r"rrrrrsrc@seZdZdZddZdS)FormDataRoutingRedirectzThis exception is raised by Flask in debug mode if it detects a redirect caused by the routing system when the request method is not GET, HEAD or OPTIONS. Reasoning: form data will be dropped. cCsr|j}d|j|jfg}|jd|jddkr<|d|d|j|dt|d | d dS) NzjA request was sent to this URL (%s) but a redirect was issued automatically by the routing system to "%s"./?rz The URL was defined with a trailing slash so Flask will automatically redirect to the URL with the trailing slash if it was accessed without one.z Make sure to directly send your %s-request to this URL since we can't make browsers or HTTP clients redirect with form data reliably or without user interaction.z3 Note: this exception is only raised in debug moderzutf-8) Zrouting_exceptionurlnew_urlbase_urlsplitrmethodAssertionErrorr rencode)rrexcrrrrr <s   z FormDataRoutingRedirect.__init__N)r r r r r rrrrr#6sr#cs:jjGfddd}j|_j|_|j_dS)zSince Flask 0.8 we're monkeypatching the files object in case a request is detected that does not use multipart form data but the files object is accessed. cseZdZfddZdS)z.attach_enctype_error_multidict..newclscs>z||WStk r8|jkr*t|YnXdSr!) __getitem__KeyErrorrr)rrZoldclsrrrr.^s  z:attach_enctype_error_multidict..newcls.__getitem__N)r r r r.rr0rrnewcls]sr1N)files __class__r r )rr1rr0rattach_enctype_error_multidictVs  r4ccsdt|jt|jfVt|jD]|\}}|dr.z%s:z - %sz%s: %r)typer r sorted__dict__items startswithr6tuplelistallr7rintfloatbool)loaderrvalueitemrrr_dump_loader_infoks   rFcCsjd|g}d}d}tj}|dk r4|jjdk r4|jj}t|D]\}\}} } t| tr`d| j} n$t| tr|d| j | jf} nt | } | d|d| ft |D]} | d| q| dkrd } nd | dpd } |d7}| d | qz -> %sFz'Error: the template could not be found.Tzs        0