module documentation

Undocumented

Function fake​_traceback No summary
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.
Function tb​_set​_next Undocumented
def fake_traceback(exc_value, tb, filename, lineno):
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.
Parameters
exc​_value:BaseExceptionThe original exception to be re-raised to create the new traceback.
tb:t.Optional[TracebackType]The original traceback to get the local variables and code info from.
filename:strThe template filename.
lineno:intThe line number in the template source.
Returns
TracebackTypeUndocumented
def get_template_locals(real_locals):
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):

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.

Parameters
source:t.Optional[str]For TemplateSyntaxError, the original source if known.
Returns
BaseExceptionThe original exception with the rewritten traceback.
def tb_set_next(tb, tb_next):

Undocumented

Parameters
tb:TracebackTypeUndocumented
tb​_next:t.Optional[TracebackType]Undocumented
Returns
TracebackTypeUndocumented