Method: flask.blueprints.Blueprint.add_app_template_global
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
test_template_global.
None (1)
1@setupmethod
2 def add_app_template_global(
3 self, f: ft.TemplateGlobalCallable, name: str | None = None
4 ) -> None:
5 """Register a template global, available in any template rendered by the
6 application. Works like the :meth:`app_template_global` decorator. Equivalent to
7 :meth:`.Flask.add_template_global`.
8
9 .. versionadded:: 0.10
10
11 :param name: the optional name of the global, otherwise the
12 function name will be used.
13 """
14
15 def register_template(state: BlueprintSetupState) -> None:
16 state.app.jinja_env.globals[name or f.__name__] = f
17
18 self.record_once(register_template)