Home / Function/ max_form_parts() — flask Function Reference

max_form_parts() — flask Function Reference

Architecture documentation for the max_form_parts() function in wrappers.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  f6640fec_4973_5c70_8c93_1e49518e40b6["max_form_parts()"]
  eae007fa_ef39_ed97_113d_df4ad5001c0e["Request"]
  f6640fec_4973_5c70_8c93_1e49518e40b6 -->|defined in| eae007fa_ef39_ed97_113d_df4ad5001c0e
  style f6640fec_4973_5c70_8c93_1e49518e40b6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/wrappers.py lines 120–140

    def max_form_parts(self) -> int | None:
        """The maximum number of fields that may be present in a
        ``multipart/form-data`` body. If this limit is exceeded, a 413
        :exc:`~werkzeug.exceptions.RequestEntityTooLarge` error is raised. If it
        is set to ``None``, no limit is enforced at the Flask application level.

        Each request defaults to the :data:`MAX_FORM_PARTS` config, which
        defaults to ``1_000``. It can be set on a specific ``request`` to apply
        the limit to that specific view. This should be set appropriately based
        on an application's or view's specific needs.

        .. versionchanged:: 3.1
            This is configurable through Flask config.
        """
        if self._max_form_parts is not None:
            return self._max_form_parts

        if not current_app:
            return super().max_form_parts

        return current_app.config["MAX_FORM_PARTS"]  # type: ignore[no-any-return]

Subdomains

Frequently Asked Questions

What does max_form_parts() do?
max_form_parts() is a function in the flask codebase, defined in src/flask/wrappers.py.
Where is max_form_parts() defined?
max_form_parts() is defined in src/flask/wrappers.py at line 120.

Analyze Your Own Codebase

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

Try Supermodel Free