File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/jinja2/debug.pyc
Back
� �t�^c @ s d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d � Z d � Z d � Z e j d k r� d � Z nm e r� y d d l Z Wn e k r� d � Z qXd � Z n. d d l Z d e j f d � � YZ d � Z d S( i����N( t CodeTypei ( t TemplateSyntaxError( t PYPY( t internal_code( t missingc C sv t j � \ } } } t | t � r� | j r� t | _ | | _ y | j d � Wn t k rd n Xt | d | j pz d | j � } n | j } g } x� | d k r<| j j t k r� | j } q� n | j j j d � } | d k r#| j | j � } t | | | j | � } | j | � n | j | � | j } q� Wd } x# t | � D] } t | | � } qPW| | | f S( s� 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 exc_info: A :meth:`sys.exc_info` tuple. If not provided, the current ``exc_info`` is used. :param source: For ``TemplateSyntaxError``, the original source if known. :return: A :meth:`sys.exc_info` tuple that can be re-raised. s <unknown>t __jinja_template__N( t syst exc_infot isinstanceR t translatedt Truet sourcet with_tracebackt Nonet AttributeErrort fake_tracebackt filenamet linenot tb_nextt tb_framet f_codeR t f_globalst gett get_corresponding_linenot tb_linenot appendt reversedt tb_set_next( R t exc_typet exc_valuet tbt stackt templateR t fake_tbR ( ( s; /opt/imh-python/lib/python2.7/site-packages/jinja2/debug.pyt rewrite_traceback_stack s6 ! c B s� | d k r1 e | j j � } | j d d � n i } i | d 6| d 6| d 6} e d | d d | d � } yd } | d k r� | j j j } | d k r� d } q� | j d � r� d | d } q� n g } x� d d d d d d d d d d d | f d | f d d d d f D]a } e | e � rA| j | d � qn y | j e | d | � � Wqe k ruqqXqWe | � } Wn e k r�n Xy | | | UWn e k r�e j � d j SXd S(! s, 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. t __jinja_exception__t __name__t __file__s i s raise __jinja_exception__t execR t roots top-level template codet block_s block "%s"i t argcountt posonlyargcountt kwonlyargcountt nlocalst stacksizet flagst codet constst namest varnamesR t namet firstlinenot lnotabt freevarst cellvarst co_i N( R t get_template_localsR t f_localst popt compileR t co_namet startswithR t tupleR t getattrR R t Exceptiont BaseExceptionR R R ( R R R R t localst globalsR/ t locationt functiont code_argst attr( ( s; /opt/imh-python/lib/python2.7/site-packages/jinja2/debug.pyR L sb c C s< | j d � } | r* | j � j � } n i } i } x� | j � D]� \ } } | j d � sC | t k rq qC n y+ | j d d � \ } } } t | � } Wn t k r� qC n X| j | d � d } | | k rC | | f | | <qC qC WxI | j � D]; \ } \ } } | t k r*| j | d � q� | | | <q� W| S( sl Based on the runtime locals, get the context that would be available at that point in the template. t contextt l_t _i i����i ( i����N( R t get_allt copyt itemsR>