Home / Function/ add_template_global() — flask Function Reference

add_template_global() — flask Function Reference

Architecture documentation for the add_template_global() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  0e3cfe3f_c0f7_b85e_687d_7b948d72ea92["add_template_global()"]
  38f6d4a2_834e_2acd_e1b6_f45c58079ccd["App"]
  0e3cfe3f_c0f7_b85e_687d_7b948d72ea92 -->|defined in| 38f6d4a2_834e_2acd_e1b6_f45c58079ccd
  1c489010_e03a_ca42_0696_19196157269f["template_global()"]
  1c489010_e03a_ca42_0696_19196157269f -->|calls| 0e3cfe3f_c0f7_b85e_687d_7b948d72ea92
  377f4c39_a79f_f005_76ce_f8af5079fd4c["add_app_template_global()"]
  377f4c39_a79f_f005_76ce_f8af5079fd4c -->|calls| 0e3cfe3f_c0f7_b85e_687d_7b948d72ea92
  style 0e3cfe3f_c0f7_b85e_687d_7b948d72ea92 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/app.py lines 807–821

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

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

        :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
        """
        self.jinja_env.globals[name or f.__name__] = f

Subdomains

Frequently Asked Questions

What does add_template_global() do?
add_template_global() is a function in the flask codebase, defined in src/flask/sansio/app.py.
Where is add_template_global() defined?
add_template_global() is defined in src/flask/sansio/app.py at line 807.
What calls add_template_global()?
add_template_global() is called by 2 function(s): add_app_template_global, template_global.

Analyze Your Own Codebase

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

Try Supermodel Free