Home / Class/ FormDataRoutingRedirect Class — flask Architecture

FormDataRoutingRedirect Class — flask Architecture

Architecture documentation for the FormDataRoutingRedirect class in debughelpers.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  e309d995_3986_928f_f772_c62d4f2b88b0["FormDataRoutingRedirect"]
  7fa0faba_d854_797c_b6bd_20820e905793["debughelpers.py"]
  e309d995_3986_928f_f772_c62d4f2b88b0 -->|defined in| 7fa0faba_d854_797c_b6bd_20820e905793
  db606e1f_5766_8b37_9e36_ff175fdea907["__init__()"]
  e309d995_3986_928f_f772_c62d4f2b88b0 -->|method| db606e1f_5766_8b37_9e36_ff175fdea907

Relationship Graph

Source Code

src/flask/debughelpers.py lines 50–78

class FormDataRoutingRedirect(AssertionError):
    """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.
    """

    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))

Frequently Asked Questions

What is the FormDataRoutingRedirect class?
FormDataRoutingRedirect is a class in the flask codebase, defined in src/flask/debughelpers.py.
Where is FormDataRoutingRedirect defined?
FormDataRoutingRedirect is defined in src/flask/debughelpers.py at line 50.

Analyze Your Own Codebase

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

Try Supermodel Free