ó žòœMc@s dZddlZddlZddlZddlmZdefd„ƒYZdefd„ƒYZd„Z d efd „ƒYZ d efd „ƒYZ d efd„ƒYZ defd„ƒYZ de fd„ƒYZdefd„ƒYZdd„Zd„ZdS(sexception classesiÿÿÿÿN(tutilt MakoExceptioncBseZRS((t__name__t __module__(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR stRuntimeExceptioncBseZRS((RR(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyRscCs/|dkrd||fSd|||fSdS(Ns at line: %d char: %ds" in file '%s' at line: %d char: %d(tNone(tlinenotpostfilename((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyt_format_fileposs tCompileExceptioncBseZd„ZRS(cCsHtj||t|||ƒƒ||_||_||_||_dS(N(Rt__init__R RRRtsource(tselftmessageR RRR((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR s     (RRR (((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR stSyntaxExceptioncBseZd„ZRS(cCsHtj||t|||ƒƒ||_||_||_||_dS(N(RR R RRRR (R RR RRR((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR "s     (RRR (((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR!stUnsupportedErrorcBseZdZRS(s&raised when a retired feature is used.(RRt__doc__(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR)stTemplateLookupExceptioncBseZRS((RR(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR,stTopLevelLookupExceptioncBseZRS((RR(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR/st RichTracebackcBsteZdZd d d„Zed„ƒZd„Zd„Zed„ƒZ ed„ƒZ ed„ƒZ d„Z RS( sªPulls the current exception from the sys traceback and extracts Mako-specific template information. See the usage examples in :ref:`handling_exceptions`. cCséd\|_|_|dks*|dkrBtjƒ\}}}n|dkr]|pW|}n|dkrr|}n||_|j|ƒ|_t|jt t fƒrÛddl }|jj|_|jj|_t |_ n|jƒdS(Ntiiÿÿÿÿ(Ri(R RRtsystexc_infoterrort_inittrecordst isinstanceR Rt mako.templatetTruet _has_sourcet _init_message(R Rt tracebacktttvaluettbacktmako((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR 9s      cCstj|jƒS(N(Rtexception_nameR(R ((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyt errornamePscCs˜yt|jƒ|_WnNtk rfyt|jƒ|_Wqgtk rb|jjd|_qgXnXt|jtƒs”t|jddƒ|_ndS(s+Find a unicode representation of self.erroritasciitreplaceN(tunicodeRRt UnicodeErrortstrtUnicodeEncodeErrortargsR(R ((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyRTs  ccs[xT|D]L}|ddk rA|d|d|d|dfVqt|dd!ƒVqWdS(Niiiii(Rttuple(R Rtrec((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyt_get_reformatted_recordsbs $cCst|j|jƒƒS(s©return a list of 4-tuple traceback records (i.e. normal python format) with template-corresponding lines remapped to the originating template. (tlistR0R(R ((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyR iscCs t|jƒS(N(treversedR(R ((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pytreverse_recordsrscCst|j|jƒƒS(sDreturn the same data as traceback, except in reverse order. (R1R0R3(R ((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pytreverse_tracebackvsc Csrddl}i}tj|ƒ}g}x8|D]0\}}}} | sOd} ny||\} } Wn tk ry7|jj|ƒ} | j} | j}| jp¦|}Wnµtk rat j s6y,t |dƒ}t j |ƒ}|j ƒWntk rd}nX|r!| j|ƒ} q6| jddƒ} n|j|||| ddddfƒq.nXd}}i} x[| jdƒD]J} tjd | ƒ}|r¸t|jdƒƒ}n|d7}|| | <%! from mako.exceptions import RichTraceback %>\ <% tback = RichTraceback(error=error, traceback=traceback) %>\ Traceback (most recent call last): % for (filename, lineno, function, line) in tback.traceback: File "${filename}", line ${lineno}, in ${function or '?'} ${line | trim} % endfor ${tback.errorname}: ${tback.message} (RR8tTemplate(tlookupR$((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyttext_error_templateÎs  cCs.ddl}|jjddtjƒddƒS(sProvides a template that renders a stack trace in an HTML format, providing an excerpt of code as well as substituting source template filenames, line numbers and code for that of the originating source template, as applicable. The template's default encoding_errors value is 'htmlentityreplace'. the template has two options. With the full option disabled, only a section of an HTML document is returned. with the css option disabled, the default stylesheet won't be included. iÿÿÿÿNsQ <%! from mako.exceptions import RichTraceback %> <%page args="full=True, css=True, error=None, traceback=None"/> % if full: Mako Runtime Error % endif % if css: % endif % if full: % endif

Error !

<% tback = RichTraceback(error=error, traceback=traceback) src = tback.source line = tback.lineno if src: lines = src.split('\n') else: lines = None %>

${tback.errorname}: ${tback.message}

% if lines:
% for index in range(max(0, line-4),min(len(lines), line+5)): % if index + 1 == line:
${index + 1} ${lines[index] | h}
% else:
${index + 1} ${lines[index] | h}
% endif % endfor
% endif
% for (filename, lineno, function, line) in tback.reverse_traceback:
${filename}, line ${lineno}:
${line | h}
% endfor
% if full: % endif toutput_encodingtencoding_errorsthtmlentityreplace(RR8R^Rtgetdefaultencoding(R$((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pythtml_error_templateæs  @(RR RRDR$Rt ExceptionRRR R RRRRtobjectRRR`Re(((s5/usr/lib/python2.7/vendor-packages/mako/exceptions.pyts$ œ