Home / Function/ url_value_preprocessor() — flask Function Reference

url_value_preprocessor() — flask Function Reference

Architecture documentation for the url_value_preprocessor() function in scaffold.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  ddc4c978_145c_dbf8_4dfe_d3c931cadccc["url_value_preprocessor()"]
  a813bd5c_bf41_d926_8dde_6a113d5e0018["Scaffold"]
  ddc4c978_145c_dbf8_4dfe_d3c931cadccc -->|defined in| a813bd5c_bf41_d926_8dde_6a113d5e0018
  style ddc4c978_145c_dbf8_4dfe_d3c931cadccc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/scaffold.py lines 559–581

    def url_value_preprocessor(
        self,
        f: T_url_value_preprocessor,
    ) -> T_url_value_preprocessor:
        """Register a URL value preprocessor function for all view
        functions in the application. These functions will be called before the
        :meth:`before_request` functions.

        The function can modify the values captured from the matched url before
        they are passed to the view. For example, this can be used to pop a
        common language code value and place it in ``g`` rather than pass it to
        every view.

        The function is passed the endpoint name and values dict. The return
        value is ignored.

        This is available on both app and blueprint objects. When used on an app, this
        is called for every request. When used on a blueprint, this is called for
        requests that the blueprint handles. To register with a blueprint and affect
        every request, use :meth:`.Blueprint.app_url_value_preprocessor`.
        """
        self.url_value_preprocessors[None].append(f)
        return f

Subdomains

Frequently Asked Questions

What does url_value_preprocessor() do?
url_value_preprocessor() is a function in the flask codebase, defined in src/flask/sansio/scaffold.py.
Where is url_value_preprocessor() defined?
url_value_preprocessor() is defined in src/flask/sansio/scaffold.py at line 559.

Analyze Your Own Codebase

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

Try Supermodel Free