Ńň -!Lc@s dZddkZddkZddkZddklZdefd„ƒ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__(((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR stRuntimeExceptioncBseZRS((RR(((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyRscCs1|djod||fSd|||fSdS(Ns at line: %d char: %ds" in file '%s' at line: %d char: %d(tNone(tlinenotpostfilename((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyt_format_fileposs tCompileExceptioncBseZd„ZRS(cCsHti||t|||ƒƒ||_||_||_||_dS(N(Rt__init__R RRRtsource(tselftmessageR RRR((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR s     (RRR (((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR stSyntaxExceptioncBseZd„ZRS(cCsHti||t|||ƒƒ||_||_||_||_dS(N(RR R RRRR (R RR RRR((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR "s     (RRR (((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR!stUnsupportedErrorcBseZdZRS(s&raised when a retired feature is used.(RRt__doc__(((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR)stTemplateLookupExceptioncBseZRS((RR(((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR,stTopLevelLookupExceptioncBseZRS((RR(((s3/usr/lib/python2.6/site-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. Usage: RichTraceback() Properties: error - the exception instance. message - the exception error message as unicode source - source code of the file where the error occured. if the error occured within a compiled template, this is the template source. lineno - line number where the error occured. if the error occured within a compiled template, the line number is adjusted to that of the template source records - a list of 8-tuples containing the original python traceback elements, plus the filename, line number, source line, and full template source for the traceline mapped back to its originating source template, if any for that traceline (else the fields are None). reverse_records - the list of records in reverse traceback - a list of 4-tuples, in the same format as a regular python traceback, with template-corresponding traceback records replacing the originals reverse_traceback - the traceback list in reverse cCsód\|_|_|djp |djotiƒ\}}}n|djo|p|}n|djo |}n||_|i|ƒ|_t|it t fƒo7ddk }|ii|_|ii|_t |_ n|iƒdS(Ntii˙˙˙˙(Ri(R RRtsystexc_infoterrort_inittrecordst isinstanceR Rt mako.templatetTruet _has_sourcet _init_message(R Rt tracebacktttvaluettbacktmako((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR Ps      cCsti|iƒS(N(Rtexception_nameR(R ((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyt errornamegscCsžyt|iƒ|_WnRtj oFyt|iƒ|_Wqktj o|iid|_qkXnXt|itƒpt|iddƒ|_ndS(s+Find a unicode representation of self.erroritasciitreplaceN(tunicodeRRt UnicodeErrortstrtUnicodeEncodeErrortargsR(R ((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyRksccs]xV|D]N}|ddj o%|d|d|d|dfVqt|dd!ƒVqWdS(Niiiii(Rttuple(R Rtrec((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyt_get_reformatted_recordsys %cCst|i|iƒƒ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 ((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyR €scCs t|iƒS(N(treversedR(R ((s3/usr/lib/python2.6/site-packages/mako/exceptions.pytreverse_records‰scCst|i|iƒƒS(sDreturn the same data as traceback, except in reverse order. (R1R0R3(R ((s3/usr/lib/python2.6/site-packages/mako/exceptions.pytreverse_tracebackscCsŸddk}h}ti|ƒ}g}x[|D]S\}}}} | p d} ny||\} } Wnżtj oły8|ii|ƒ} | i} | i}| ip|}Wn˝tj oąt i pxy,t |dƒ}t i |ƒ}|i ƒWntj o d}nX|o| i|ƒ} qA| iddƒ} n|i|||| ddddfƒq.nXd}}h} xg| idƒD]V} tid | ƒ}|ot|idƒƒ}n |d7}|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$((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyttext_error_templateçs  cCs.ddk}|iiddtiƒ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$((s3/usr/lib/python2.6/site-packages/mako/exceptions.pythtml_error_template˙s  @(RR RRDR$Rt ExceptionRRR R RRRRtobjectRRRaRf(((s3/usr/lib/python2.6/site-packages/mako/exceptions.pyts$ ľ