module documentation

Undocumented

Function fake_traceback Produce a new traceback object that looks like it came from the template source instead of the compiled code. The filename, line number, and location name will point to the template, and the local variables will be the current template context.
Function get_template_locals Based on the runtime locals, get the context that would be available at that point in the template.
Function rewrite_traceback_stack Rewrite the current exception to replace any tracebacks from within compiled template code with tracebacks that look like they came from the template source.
def fake_traceback(exc_value, tb, filename, lineno): (source)

Produce a new traceback object that looks like it came from the template source instead of the compiled code. The filename, line number, and location name will point to the template, and the local variables will be the current template context. :param exc_value: The original exception to be re-raised to create the new traceback. :param tb: The original traceback to get the local variables and code info from. :param filename: The template filename. :param lineno: The line number in the template source.

Parameters
exc_value:BaseExceptionUndocumented
tb:t.Optional[TracebackType]Undocumented
filename:strUndocumented
lineno:intUndocumented
Returns
TracebackTypeUndocumented
def get_template_locals(real_locals): (source)

Based on the runtime locals, get the context that would be available at that point in the template.

Parameters
real_locals:t.Mapping[str, t.Any]Undocumented
Returns
t.Dict[str, t.Any]Undocumented
def rewrite_traceback_stack(source=None): (source)

Rewrite the current exception to replace any tracebacks from within compiled template code with tracebacks that look like they came from the template source. This must be called within an ``except`` block. :param source: For ``TemplateSyntaxError``, the original source if known. :return: The original exception with the rewritten traceback.

Parameters
source:t.Optional[str]Undocumented
Returns
BaseExceptionUndocumented