zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
U
ß=®d«ã@s–ddlmZddlZddlmZddlmZddlm    Z    Gdd„de
e ƒZ Gd    d
„d
e e
ƒZGd d „d e
ƒZd d„Zddœdd„Zdddœdd„ZdS)é)Ú annotationsNé)ÚFlask)Ú    Blueprint)Ú request_ctxc@seZdZdZdS)ÚUnexpectedUnicodeErrorzjRaised in places where we want some better error reporting for
    unexpected unicode or binary data.
    N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__©r r úId:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\flask/debughelpers.pyr
src@s eZdZdZdd„Zdd„ZdS)ÚDebugFilesKeyErrorz•Raised 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|j›dg}|rJd dd„|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|ƒVqdS©N)Úrepr©Ú.0Úxr r r Ú    <genexpr> sz.DebugFilesKeyError.__init__.<locals>.<genexpr>zG
 
The browser instead transmitted some file names. This was submitted: Ú)ÚformÚgetlistÚmimetypeÚjoinÚappendÚmsg)ÚselfÚrequestÚkeyZ form_matchesÚbufÚnamesr 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 rsrcs eZdZdZ‡fdd„Z‡ZS)ÚFormDataRoutingRedirectzÝThis exception is raised in debug mode if a routing redirect
    would cause the browser to drop the method or body. This happens
    when method is not GET, HEAD or OPTIONS and the status code is not
    307 or 308.
    csd|j}d|j›d|j›dg}|j›d|j d¡dkrD| d¡| d¡tƒ d     |¡¡dS)
NzA request was sent to 'z7', but routing issued a redirect to the canonical URL 'z'.ú/ú?rz€ The URL was defined with a trailing slash. Flask will redirect to the URL with a trailing slash if it was accessed without one.z¤ Send requests to the canonical URL, or use 307 or 308 for routing redirects. Otherwise, browsers will drop form data.
 
This exception is only raised in debug mode.r)    Zrouting_exceptionÚurlÚnew_urlÚbase_urlÚ    partitionrÚsuperr!r)rrÚexcr©Ú    __class__r r r!2sÿÿÿz FormDataRoutingRedirect.__init__)rr    r
r r!Ú __classcell__r r r,r r#+sr#cs8ˆjj}G‡fdd„d|ƒ}|j|_|j|_|ˆj_dS)z®Patch ``request.files.__getitem__`` to raise a descriptive error
    about ``enctype=multipart/form-data``.
 
    :param request: The request to patch.
    :meta private:
    cseZdZ‡‡fdd„Z‡ZS)z.attach_enctype_error_multidict.<locals>.newclsc
sVztƒ |¡WStk
rP}z$|ˆjkr,‚tˆ|ƒ |j¡d‚W5d}~XYnXdSr)r*Ú __getitem__ÚKeyErrorrrÚwith_tracebackÚ __traceback__)rrÚe)r-rr r r/Ss
 
ÿþz:attach_enctype_error_multidict.<locals>.newcls.__getitem__)rr    r
r/r.r ©rr,r ÚnewclsRsr5N)Úfilesr-rr    )rZoldclsr5r r4r Úattach_enctype_error_multidictIs
 r7z t.Generator)Úreturnccs²dt|ƒj›dt|ƒj›Vt|j ¡ƒD]€\}}| d¡r@q,t|tt    fƒrˆt
dd„|Dƒƒsbq,|›dV|D]}d|›Vqrq,nt|t t t tfƒsœq,|›d|›Vq,dS)    Nzclass: Ú.Ú_css|]}t|tƒVqdSr)Ú
isinstanceÚstrrr r r risz$_dump_loader_info.<locals>.<genexpr>ú:z  - z: )Útyper    rÚsortedÚ__dict__ÚitemsÚ
startswithr;ÚtupleÚlistÚallr<ÚintÚfloatÚbool)ÚloaderrÚvalueÚitemr r r Ú_dump_loader_infocs
 rLrÚNone)Úappr8cCs|d|›dg}d}d}tr.tjjdk    r.tjj}t|ƒD]Â\}\}}}    t|tƒr\d|j›}
n*t|tƒr~d|j›d|j›d}
nt    |ƒ}
| 
|d    d
›d |
›¡t |ƒD]} | 
d | ›¡q¨|    dkrÌd } nd|    d    pØd›d} |d    7}| 
d| ›¡q6d} |dkr| 
d¡d} n|d    kr0| 
d¡d} |dk    rf| rf| 
d|›d¡| 
d¡| 
d¡|j   d |¡¡dS)z2This should help developers understand what failedzLocating template r=rNz application z
blueprint z (ú)rÚ5z: trying loader of z       zno matchzfound (z<string>z
       -> Fz'Error: the template could not be found.Tz<Warning: multiple loaders returned a match for the template.zL  The template was looked up from an endpoint that belongs to the blueprint r9z9  Maybe you did not place a template in the right folder?z=  See https://flask.palletsprojects.com/blueprints/#templatesÚ
)rrÚ    blueprintÚ    enumerater;rÚ import_namerÚnamerrrLÚloggerÚinfor)rNÚtemplateÚattemptsrWZ total_foundrRÚidxrIÚsrcobjZtripleZsrc_infoÚlineZdetailZ seems_fishyr r r Ú!explain_template_loading_attemptstsB
 
 
 
 
 
 
ÿ
 
r])Ú
__future__rÚtypingÚtrNrZ
blueprintsrÚglobalsrÚAssertionErrorÚ UnicodeErrorrr0rr#r7rLr]r r r r Ú<module>s