core.render.html.utils

Module Contents

Functions

getGlobalFunctions()

getGlobalFilters()

getGlobalTests()

getGlobalExtensions()

jinjaGlobalFunction(f)

Decorator, marks a function as a Jinja2 global.

jinjaGlobalFilter(f)

Decorator, marks a function as a Jinja2 filter.

jinjaGlobalTest(func_or_alias)

Decorator, marks a function as a Jinja2 test.

jinjaGlobalExtension(ext)

Function for activating extensions in Jinja2.

Attributes

__jinjaGlobals_

__jinjaFilters_

__jinjaTests_

__jinjaExtensions_

core.render.html.utils.__jinjaGlobals_
core.render.html.utils.__jinjaFilters_
core.render.html.utils.__jinjaTests_
core.render.html.utils.__jinjaExtensions_ = []
core.render.html.utils.getGlobalFunctions()
core.render.html.utils.getGlobalFilters()
core.render.html.utils.getGlobalTests()
core.render.html.utils.getGlobalExtensions()
core.render.html.utils.jinjaGlobalFunction(f)

Decorator, marks a function as a Jinja2 global.

core.render.html.utils.jinjaGlobalFilter(f)

Decorator, marks a function as a Jinja2 filter.

core.render.html.utils.jinjaGlobalTest(func_or_alias)

Decorator, marks a function as a Jinja2 test.

To avoid name conflicts you can call the decorator with an alias as first argument. Otherwise, the test will be registered under the function name.

# Example:
from viur.core.render.html import jinjaGlobalTest
# @jinjaGlobalTest  # available under "positive_number"

@jinjaGlobalTest("positive")  # available under "positive"
def positive_number(render, value):
    return isinstance(value, int) and value > 0
Parameters:

func_or_alias (Callable | str) –

Return type:

Callable

core.render.html.utils.jinjaGlobalExtension(ext)

Function for activating extensions in Jinja2.