Home / Function/ add_app_template_global() — flask Function Reference

add_app_template_global() — flask Function Reference

Architecture documentation for the add_app_template_global() function in blueprints.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  377f4c39_a79f_f005_76ce_f8af5079fd4c["add_app_template_global()"]
  0c59fa87_9a90_f011_4207_98ae96479921["Blueprint"]
  377f4c39_a79f_f005_76ce_f8af5079fd4c -->|defined in| 0c59fa87_9a90_f011_4207_98ae96479921
  a39782a2_be2a_db88_5672_4e5a6f541caa["app_template_global()"]
  a39782a2_be2a_db88_5672_4e5a6f541caa -->|calls| 377f4c39_a79f_f005_76ce_f8af5079fd4c
  0085606d_b5d3_d0dc_0155_6135d079c059["record_once()"]
  377f4c39_a79f_f005_76ce_f8af5079fd4c -->|calls| 0085606d_b5d3_d0dc_0155_6135d079c059
  0e3cfe3f_c0f7_b85e_687d_7b948d72ea92["add_template_global()"]
  377f4c39_a79f_f005_76ce_f8af5079fd4c -->|calls| 0e3cfe3f_c0f7_b85e_687d_7b948d72ea92
  style 377f4c39_a79f_f005_76ce_f8af5079fd4c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/blueprints.py lines 590–611

    def add_app_template_global(
        self, f: ft.TemplateGlobalCallable, name: str | None = None
    ) -> None:
        """Register a function to use as a custom Jinja global.

        The :meth:`app_template_global` decorator can be used to register a function
        by decorating instead.

        The global is available in all templates, not only those under this
        blueprint. Equivalent to :meth:`.Flask.add_template_global`.

        :param f: The function to register.
        :param name: The name to register the global as. If not given, uses the
            function's name.

        .. versionadded:: 0.10
        """

        def register_template_global(state: BlueprintSetupState) -> None:
            state.app.add_template_global(f, name=name)

        self.record_once(register_template_global)

Subdomains

Frequently Asked Questions

What does add_app_template_global() do?
add_app_template_global() is a function in the flask codebase, defined in src/flask/sansio/blueprints.py.
Where is add_app_template_global() defined?
add_app_template_global() is defined in src/flask/sansio/blueprints.py at line 590.
What does add_app_template_global() call?
add_app_template_global() calls 2 function(s): add_template_global, record_once.
What calls add_app_template_global()?
add_app_template_global() is called by 1 function(s): app_template_global.

Analyze Your Own Codebase

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

Try Supermodel Free