Path 1: 1 calls (1.0)

None (1)

Flask.template_global..decorator def (1)

1@setupmethod
2    def template_global(
3        self, name: str | None = None
4    ) -> t.Callable[[T_template_global], T_template_global]:
5        """A decorator that is used to register a custom template global function.
6        You can specify a name for the global function, otherwise the function
7        name will be used. Example::
8
9            @app.template_global()
10            def double(n):
11                return 2 * n
12
13        .. versionadded:: 0.10
14
15        :param name: the optional name of the global function, otherwise the
16                     function name will be used.
17        """
18
19        def decorator(f: T_template_global) -> T_template_global:
20            self.add_template_global(f, name=name)
21            return f
22
23        return decorator