Home / Function/ __init__() — flask Function Reference

__init__() — flask Function Reference

Architecture documentation for the __init__() function in debughelpers.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  db606e1f_5766_8b37_9e36_ff175fdea907["__init__()"]
  e309d995_3986_928f_f772_c62d4f2b88b0["FormDataRoutingRedirect"]
  db606e1f_5766_8b37_9e36_ff175fdea907 -->|defined in| e309d995_3986_928f_f772_c62d4f2b88b0
  style db606e1f_5766_8b37_9e36_ff175fdea907 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/debughelpers.py lines 57–78

    def __init__(self, request: Request) -> None:
        exc = request.routing_exception
        assert isinstance(exc, RequestRedirect)
        buf = [
            f"A request was sent to '{request.url}', but routing issued"
            f" a redirect to the canonical URL '{exc.new_url}'."
        ]

        if f"{request.base_url}/" == exc.new_url.partition("?")[0]:
            buf.append(
                " The URL was defined with a trailing slash. Flask"
                " will redirect to the URL with a trailing slash if it"
                " was accessed without one."
            )

        buf.append(
            " Send requests to the canonical URL, or use 307 or 308 for"
            " routing redirects. Otherwise, browsers will drop form"
            " data.\n\n"
            "This exception is only raised in debug mode."
        )
        super().__init__("".join(buf))

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the flask codebase, defined in src/flask/debughelpers.py.
Where is __init__() defined?
__init__() is defined in src/flask/debughelpers.py at line 57.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free