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