3
U'íc.! ã @ s d dl Z d dlZd dlZd dlmZ d dlmZ ddlmZ ddl m
Z
ddl mZ ejrfddl
mZ deje ed d
dZeeje eeedd
dZejeejf ejeejf dddZejdkræeeje edddZne j dkrJyd dlZW n. ek
r. eeje edddZY nX eeje edddZn2d dlZG dd dejZ eeje edddZdS )é N)ÚCodeType)Ú
TracebackTypeé )ÚTemplateSyntaxError)Ú
internal_code)Úmissing)ÚContext)ÚsourceÚreturnc C s
t j \}}}tjt|}tjt|}t|trf|j rfd|_| |_ |j
d t|d|jp\d|j
}n|j}g }xn|dk rÞ|jjtkr|j}qr|jjjd}|dk rÌ|j|j}t|||j|}|j| n
|j| |j}qrW d}xt|D ]}t||}qîW |j
|S )ax 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.
TNz <unknown>Z__jinja_template__)ÚsysÚexc_infoÚtÚcastÚ
BaseExceptionr Ú
isinstancer Z
translatedr Úwith_tracebackÚfake_tracebackÚfilenameÚlinenoÚtb_nextÚtb_frameÚf_coder Ú f_globalsÚgetZget_corresponding_linenoÚ tb_linenoÚappendÚreversedÚtb_set_next) r Ú_Ú exc_valueÚtbÚstackÚtemplater Zfake_tbr © r# ú./tmp/pip-build-gk9425m9/Jinja2/jinja2/debug.pyÚrewrite_traceback_stack s4
r% )r r r r r