Method: flask.app.Flask.add_template_global
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
test_add_template_global.
None (1)
1@setupmethod
2 def add_template_global(
3 self, f: ft.TemplateGlobalCallable, name: str | None = None
4 ) -> None:
5 """Register a custom template global function. Works exactly like the
6 :meth:`template_global` decorator.
7
8 .. versionadded:: 0.10
9
10 :param name: the optional name of the global function, otherwise the
11 function name will be used.
12 """
13 self.jinja_env.globals[name or f.__name__] = f