U a@sddlZddlZddlmZddlmZddlmZddl m Z Gddde e Z Gd d d ee ZGd d d e Zd dZejdddZeddddZddddZdS)N)warn)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__r r SC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-e702oxwa\flask\debughelpers.pyr src@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. cCsZ|j|}d|d|jdg}|rJddd|D}|d|d||_dS) NzYou tried to access the file zX in the request.files dictionary but it does not exist. The mimetype for the request is z 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.z, css|]}t|VqdSN)repr.0xr r r sz.DebugFilesKeyError.__init__..zG The browser instead transmitted some file names. This was submitted: )formgetlistmimetypejoinappendmsg)selfrequestkeyZ form_matchesbufnamesr r r __init__s zDebugFilesKeyError.__init__cCs|jSr)r)rr r r __str__'szDebugFilesKeyError.__str__N)rr r r r!r"r r r r rsrc@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. cCs~|j}d|jd|jdg}|jd|jddkrD|d|d|jd |d t|d | d dS) Nz A request was sent to this URL (zC) but a redirect was issued automatically by the routing system to ./?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 z-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)rrexcrr r r r!1s  z FormDataRoutingRedirect.__init__N)rr r r r!r r r r r#+sr#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)rrZoldclsrr r r/Ss  z:attach_enctype_error_multidict..newcls.__getitem__N)rr r r/r r1r r newclsRsr2N)files __class__rr )rr2r r1r attach_enctype_error_multidictKs  r5)returnccsdt|jdt|jVt|jD]\}}|dr@q,t|tt frt dd|Dsbq,|dV|D]}d|Vqrq,nt|t t t tfsq,|d|Vq,dS) Nzclass: r$_css|]}t|tVqdSr) isinstancestrrr r r rfsz$_dump_loader_info..:z - z: )typer rsorted__dict__items startswithr8tuplelistallr9intfloatbool)loaderrvalueitemr r r _dump_loader_info`s  rI)appr6cCsd|dg}d}d}tj}|dk r8|jjdk r8|jj}t|D]\}\}} } t| trfd| j} n*t| trd| j d| jd} nt | } | |d d d | t |D]} | d | q| dkrd } nd| d pdd} |d 7}| d| q@d}|dkr"| dd}n|d kr:| dd}|dk rp|rp| d|d| d| d|j d|dS)z2This should help developers understand what failedzLocating template r:rNz application z blueprint z ()r5z: trying loader of z zno matchzfound (zz -> Fz'Error: the template could not be found.Tzs     0