core.render.html.utils
¶
Module Contents¶
Functions¶
Decorator, marks a function as a Jinja2 global. |
|
Decorator, marks a function as a Jinja2 filter. |
|
|
Decorator, marks a function as a Jinja2 test. |
|
Function for activating extensions in Jinja2. |
Attributes¶
- 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: Callable | str) Callable ¶
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
- core.render.html.utils.jinjaGlobalExtension(ext)¶
Function for activating extensions in Jinja2.