flask.Flask.template_global

Flask.template_global(*args, **kwargs)[source]

A decorator that is used to register a custom template global function. You can specify a name for the global function, otherwise the function name will be used. Example:

@app.template_global()
def double(n):
    return 2 * n

New in version 0.10.

Parameters:name – the optional name of the global function, otherwise the function name will be used.