MCPcopy Create free account
hub / github.com/pallets/flask / __init__

Method __init__

src/flask/debughelpers.py:57–78  ·  view source on GitHub ↗
(self, request: Request)

Source from the content-addressed store, hash-verified

55 """
56
57 def __init__(self, request: Request) -> None:
58 exc = request.routing_exception
59 assert isinstance(exc, RequestRedirect)
60 buf = [
61 f"A request was sent to '{request.url}', but routing issued"
62 f" a redirect to the canonical URL '{exc.new_url}'."
63 ]
64
65 if f"{request.base_url}/" == exc.new_url.partition("?")[0]:
66 buf.append(
67 " The URL was defined with a trailing slash. Flask"
68 " will redirect to the URL with a trailing slash if it"
69 " was accessed without one."
70 )
71
72 buf.append(
73 " Send requests to the canonical URL, or use 307 or 308 for"
74 " routing redirects. Otherwise, browsers will drop form"
75 " data.\n\n"
76 "This exception is only raised in debug mode."
77 )
78 super().__init__("".join(buf))
79
80
81def attach_enctype_error_multidict(request: Request) -> None:

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected