module documentation

The runtime functions and state used by compiled templates.

Class AsyncLoopContext Undocumented
Class BlockReference One block on a template reference.
Class ChainableUndefined An undefined that is chainable, where both ``__getattr__`` and ``__getitem__`` return itself rather than raising an :exc:`UndefinedError`.
Class Context The template context holds the variables of a template. It stores the values passed to the template and also the names the template exports. Creating instances is neither supported nor useful as it's created automatically at various stages of the template evaluation and should not be created by hand.
Class DebugUndefined An undefined that returns the debug info when printed.
Class LoopContext A wrapper iterable for dynamic ``for`` loops, with information about the loop and iteration.
Class LoopRenderFunc Undocumented
Class Macro Wraps a macro function.
Class StrictUndefined An undefined that barks on print and iteration as well as boolean tests and all kinds of comparisons. In other words: you can do nothing with it except checking if it's defined using the `defined` test.
Class TemplateReference The `self` in templates.
Class Undefined The default undefined type. This undefined type can be printed and iterated over, but every other access will raise an :exc:`UndefinedError`:
Function identity Returns its argument. Useful for certain things in the environment.
Function make_logging_undefined Given a logger object this returns a new undefined class that will log certain failures. It will log iterations and printing. If no logger is given a default logger is created.
Function markup_join Concatenation that escapes if necessary and converts to string.
Function new_context Internal helper for context creation.
Function str_join Simple args to string conversion and concatenation.
Constant F Undocumented
Constant V Undocumented
Variable async_exported Undocumented
Variable exported Undocumented
Function _dict_method_all Undocumented
def identity(x): (source)

Returns its argument. Useful for certain things in the environment.

Parameters
x:VUndocumented
Returns
VUndocumented
def make_logging_undefined(logger=None, base=Undefined): (source)

Given a logger object this returns a new undefined class that will log certain failures. It will log iterations and printing. If no logger is given a default logger is created. Example:: logger = logging.getLogger(__name__) LoggingUndefined = make_logging_undefined( logger=logger, base=Undefined ) .. versionadded:: 2.8 :param logger: the logger to use. If not provided, a default logger is created. :param base: the base class to add logging functionality to. This defaults to :class:`Undefined`.

Parameters
logger:t.Optional[logging.Logger]Undocumented
base:t.Type[Undefined]Undocumented
Returns
t.Type[Undefined]Undocumented
def markup_join(seq): (source)

Concatenation that escapes if necessary and converts to string.

Parameters
seq:t.Iterable[t.Any]Undocumented
Returns
strUndocumented
def new_context(environment, template_name, blocks, vars=None, shared=False, globals=None, locals=None): (source)

Internal helper for context creation.

Parameters
environment:EnvironmentUndocumented
template_name:t.Optional[str]Undocumented
blocks:t.Dict[str, t.Callable[[Context], t.Iterator[str]]]Undocumented
vars:t.Optional[t.Dict[str, t.Any]]Undocumented
shared:boolUndocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
locals:t.Optional[t.Mapping[str, t.Any]]Undocumented
Returns
ContextUndocumented
def str_join(seq): (source)

Simple args to string conversion and concatenation.

Parameters
seq:t.Iterable[t.Any]Undocumented
Returns
strUndocumented

Undocumented

Value
t.TypeVar('F',
          bound=t.Callable[..., t.Any])

Undocumented

Value
t.TypeVar('V')
async_exported: list[str] = (source)

Undocumented

exported: list[str] = (source)

Undocumented

def _dict_method_all(dict_method): (source)

Undocumented

Parameters
dict_method:FUndocumented
Returns
FUndocumented