module documentation

provides runtime services for templates, including Context, Namespace, and various helper functions.
Class ​Context Provides runtime namespace, output buffer, and various callstacks for templates.
Class ​Loop​Context A magic loop variable. Automatically accessible in any % for block.
Class ​Module​Namespace A .Namespace specific to a Python module instance.
Class ​Namespace Provides access to collections of rendering methods, which can be local, from other templates, or from imported modules.
Class ​Template​Namespace A .Namespace specific to a .Template instance.
Class ​Undefined Represents an undefined value in a template.
Function capture Execute the given template def, capturing the output into a buffer.
Function supports​_caller Apply a caller_stack compatibility decorator to a plain Python function.
Constant STOP​_RENDERING Undocumented
Constant UNDEFINED Undocumented
Class _​NSAttr Undocumented
Class ​Caller​Stack Undocumented
Class ​Loop​Stack a stack for LoopContexts that implements the context manager protocol to automatically pop off the top of the stack on context exit
Function ​_decorate​_inline Undocumented
Function ​_decorate​_toplevel Undocumented
Function ​_exec​_template execute a rendering callable given the callable, a Context, and optional explicit arguments
Function ​_include​_file locate the template from the given uri and include it in the current output.
Function ​_inherit​_from called by the _inherit method in template modules to set up the inheritance chain at the start of a template's execution.
Function ​_kwargs​_for​_callable Undocumented
Function ​_kwargs​_for​_include Undocumented
Function ​_lookup​_template Undocumented
Function ​_populate​_self​_namespace Undocumented
Function ​_render create a Context and return the string output of the given template and template callable.
Function ​_render​_context Undocumented
Function ​_render​_error Undocumented
def capture(context, callable_, *args, **kwargs):

Execute the given template def, capturing the output into a buffer.

See the example in :ref:`namespaces_python_modules`.

def supports_caller(func):

Apply a caller_stack compatibility decorator to a plain Python function.

See the example in :ref:`namespaces_python_modules`.

STOP_RENDERING: str =

Undocumented

Value
''
UNDEFINED =

Undocumented

Value
Undefined()
def _decorate_inline(context, fn):

Undocumented

def _decorate_toplevel(fn):

Undocumented

def _exec_template(callable_, context, args=None, kwargs=None):

execute a rendering callable given the callable, a Context, and optional explicit arguments

the contextual Template will be located if it exists, and the error handling options specified on that Template will be interpreted here.

def _include_file(context, uri, calling_uri, **kwargs):
locate the template from the given uri and include it in the current output.
def _inherit_from(context, uri, calling_uri):
called by the _inherit method in template modules to set up the inheritance chain at the start of a template's execution.
def _kwargs_for_callable(callable_, data):

Undocumented

def _kwargs_for_include(callable_, data, **kwargs):

Undocumented

def _lookup_template(context, uri, relativeto):

Undocumented

def _populate_self_namespace(context, template, self_ns=None):

Undocumented

def _render(template, callable_, args, data, as_unicode=False):
create a Context and return the string output of the given template and template callable.
def _render_context(tmpl, callable_, context, *args, **kwargs):

Undocumented

def _render_error(template, context, error):

Undocumented