Rc@sdZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZmZdd lmZmZmZmZmZmZmZid d 6d d6dd6dd6dd6dd6dd6dd6ZeedrdZndZdZ e!e"e dd1Z d1e$dZ%dZ&d Z'd!e(fd"YZ)d#e(fd$YZ*d%e+fd&YZ,d'e fd(YZ-d)e fd*YZ.d+e fd,YZ/d-e0fd.YZ1d/e fd0YZ2d1S(2s jinja2.compiler ~~~~~~~~~~~~~~~ Compiles nodes into python code. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. i(tchain(tdeepcopy(t iskeyword(tnodes(t EvalContext(t NodeVisitor(tTemplateAssertionError(tMarkuptconcattescape(t range_typetnextt text_typet string_typest iteritemstNativeStringIOtimaps==teqs!=tnet>tgts>=tgteqts(RWRGRHRIRJR8(RKtextra((Rhs3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt find_shadoweds  cCst|j|S(sReturn an inner frame.(RURV(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytinnerscCs|j}t|_|S(sReturn a soft frame. A soft frame may not be modified as standalone thing as it shares the resources with the frame it was created of, but it's not a rootlevel frame any longer. (RQR;RY(RKRd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytsofts  N(( RRRSRTR%RLRQRfRjRkRlt__copy__(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRUs +   RAcBseZdZRS(s?Exception used by the `UndeclaredNameVisitor` to signal a stop.(RRRSRT(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRAstDependencyFinderVisitorcBs2eZdZdZdZdZdZRS(s.A visitor that collects filter and test calls.cCst|_t|_dS(N(R8tfiltersttests(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLs cCs$|j||jj|jdS(N(t generic_visitRoRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Filters cCs$|j||jj|jdS(N(RqRpRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Tests cCsdS(sStop visiting at blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Blocks(RRRSRTRLRrRsRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRns    R@cBs)eZdZdZdZdZRS(sA visitor that checks if a name is accessed without being declared. This is different from the frame visitor as it will not stop at closure frames. cCst||_t|_dS(N(R8RCRB(RKRC((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCsl|jdkrU|j|jkrU|jj|j|j|jkrhtqhn|jj|jdS(Ntload(tctxR*RCRBRNRARM(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Names !cCsdS(sStop visiting a blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRt s(RRRSRTRLRwRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR@s  RecBszeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( sA visitor for `Frame.inspect`.cCs ||_dS(N(RW(RKRW((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCs|jdkr(|jjj|jnf|jdkrP|jjj|jn>|jdkr|jj|j r|jjj|jndS(s2All assignments to names go through this function.tstoretparamRuN(RvRWRIRNR*RJRPRB(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRwscsj|jjjjBfd}||j}||jp\d}jj|j |j jj||BdS(Ncsm|s tSj_x|D]}j|q#Wjj}jjjj_|S(N(R8RQRWR$RIRBR_(RtsubnodeRd(t old_namestreal_identifiersRK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt inner_visit&s  (( R$ttestRWRIRJtbodytelse_RBR_tsymmetric_differenceRG(RKR(R}RR((R{R|RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Ifs    cCs|jjj|jdS(N(RWRIRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Macro>scCs'|j||jjj|jdS(N(RqRWRIRNttarget(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_ImportAs cCsa|j|xM|jD]B}t|trF|jjj|dq|jjj|qWdS(Ni(RqRCR R6RWRIRN(RKR(R*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_FromImportEs  cCs$|j|j|j|jdS(s'Visit assignments in the correct order.N(R$R(R(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_AssignMscCs|j|jdS(sqVisiting stops at for blocks. However the block sequence is visited as part of the outer scope. N(R$titer(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_ForRscCs|j|jdS(N(R$tcall(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CallBlockXscCs|j|jdS(N(R$tfilter(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_FilterBlock[scCsdS(sStop visiting at scopes.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Scope^scCsdS(sStop visiting at blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRtas(RRRSRTRLRwRRRRRRRRRRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRes          t CompilerExitcBseZdZRS(sRaised if the compiler encountered a situation where it just doesn't make sense to further process the code. Any block that raises such an exception is not further processed. (RRRSRT(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyResR#cBsSeZdRedZdZdZdZdZdZ ddZ dRdZ d Z dRd Z d Zd ZdRd dZdRd dZdRdZdZdZdZdSdZdZdRedZdRdZdZdZdRdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0ed.Z1ed/Z2e1d0Z3e1d1Z4e1d2Z5e1d3Z6e1d4Z7e1d5Z8e1d6Z9e1d7d8eZ:e1d9d8eZ;e2d0Z<e2d1Z=e2d:d8eZ>[1[2d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGedDZHdEZIdFZJdGZKdHZLdIZMdJZNdKZOdLZPdMZQdNZRdOZSdPZTdQZURS(TcCs|dkrt}n||_||_||_||_t|_||_i|_ i|_ d|_ t|_ d|_ i|_i|_g|_d|_d|_d|_t|_d|_d|_dS(Nii(R%RR)R*R+R&R;tcreated_block_contextR,timport_aliasestblockstextends_so_farthas_known_extendst code_linenoRpRot debug_infot_write_debug_infot _new_linest _last_lineR1t _first_writet_last_identifiert _indentation(RKR)R*R+R&R,((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLns,                     cCst|||j|jdS(s*Fail with a :exc:`TemplateAssertionError`.N(RR*R+(RKtmsgtlineno((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfailscCs|jd7_d|jS(sGet a new unique identifier.ist_%d(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyttemporary_identifierscCs'|j|_|jd|jdS(s7Enable buffering for the frame from that point onwards.s%s = []N(RR[t writeline(RKtframe((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR[scCs|jjry|jd|j|jd|j|j|jd|j|jd|j|jn7|jjr|jd|jn|jd|jdS(s(Return the buffer contents of the frame.sif context.eval_ctx.autoescape:sreturn Markup(concat(%s))selse:sreturn concat(%s)N(RVtvolatileRtindentR[toutdentt autoescape(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytreturn_buffer_contentss        cCs|jd7_dS(sIndent by one.iN(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsicCs|j|8_dS(sOutdent by step.N(R(RKtstep((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRscCs=|jdkr"|jd|n|jd|j|dS(s%Yield or write into the frame buffer.syield s %s.append(N(R[R%R(RKRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt start_writescCs#|jdk r|jdndS(s1End the writing process started by `start_write`.t)N(R[R%twrite(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt end_writescCs.|j|||j||j|dS(s4Simple shortcut for start_write + write + end_write.N(RRR(RKtsRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt simple_writes cCsi|jdkr|jdn |jdy%x|D]}|j||q6WWntk rdnXdS(sVisit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically unless the force_generator parameter is set to False. sif 0: yield NonetpassN(R[R%RR$R(RKRRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt blockvisits   cCs|jr|jsu|jjd|j|j|j7_|jdk ru|jj|j|jfd|_qunt |_|jjd|j d|_n|jj|dS(s&Write a string into the output stream.s s iN( RRR&RRRR%RtappendR;R(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs     icCs!|j|||j|dS(s!Combination of newline and write.N(tnewlineR(RKRR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRscCsVt|jd||_|dk rR|j|jkrR|j|_|j|_ndS(s/Add one or more newlines before the next write.iN(tmaxRR%RRR(RKR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs c Cset}x@td|jD|p%dD]}t|r)t}Pq)q)Wx.|jD]#}|jd|j||qSW|sx.|jD]#}|jd|j||qW|d k rx4t |D]#\}}|jd||fqWqn|j r#|jd|j|j |n|r/|j d k rH|jdn |jdxE|jD]:}|jd|j |j|j ||jdq_W|d k rx4t |D]#\}}|jd||fqWn|j d k r|jd |j|j ||jd qa|jd n2|j d k ra|jd |j|j |nd S(s,Writes a function call to the stream for the current node. A leading comma is added automatically. The extra keyword arguments may not include python keywords otherwise a syntax error could occour. The extra keyword arguments should be given as python dict. css|]}|jVqdS(N(R?(RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys ss, s, %s=%ss, *s , **dict({s, **{s%r: s%r: %s, s}, **Rt}s, **N((R;Rtkwargstis_python_keywordR1targsRR$R%Rtdyn_argst dyn_kwargsR?R=( RKR(Rt extra_kwargstkwarg_workaroundtkwargtargR?R=((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt signaturesJ )    !      cCs2x+|jjD]}|jd||fq WdS(s9Pull all the references identifiers into the local scope.sl_%s = context.resolve(%r)N(RWRBR(RKRR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt pull_locals<scCst}x|D]}|j|qWxtdD]l}t||}xTt||D]C}||krx|j||WsN(RWRGRRtjoin(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytunoptimize_scopeNs  cCsi}xB|j|D]1}|j||<}|jd||fqWt}x4|jjD]&}||kra|jd|qaqaW|r|jdj|dn|S(sThis function returns all the shadowed variables in a dict in the form name: alias and will write the required assignments into the current scope. No indentation takes place. This also predefines locally declared variables from the loop body because under some circumstances it may be the case that `extra_vars` is passed to `Frame.find_shadowed`. s %s = l_%sRs = s = missing(RjRRR8RWRIRNR(RKRt extra_varstaliasesR*tidentt to_declare((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt push_scopeZs   cCsx1t|D]#\}}|jd||fq Wt}x4|jjD]&}||krJ|jd|qJqJW|r|jdj|dndS(s0Restore all aliases and delete unused variables.s l_%s = %sRs = s = missingN(RRR8RWRIRNR(RKRRR*taliast to_delete((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt pop_scopeps  c Cs|d kr|j}nt|}|j}|j||jj|jj@|jj|jj B@}|r|j ddj t ||j n|jj|jj|jj@8_|s|St|_t|_t|_g|jD]}d|j^q|_}t|d } d| krNt|_|jjd|jdnd| krt|_|jjd|jdnd| krt|_|jjd|jd n|S( sMIn Jinja a few statements require the help of anonymous functions. Those are currently macros and call blocks and in the future also recursive loops. As there is currently technical limitation that doesn't allow reading and writing a variable in a scope where the initial value is coming from an outer scope, this function tries to fall back with a common error message. Additionally the frame passed is modified so that the argumetns are collected and callers are looked up. This will return the modified frame. sXIt's not possible to set and access variables derived from an outer scope! (affects: %s)s, RtcallerRtvarargstl_callertl_kwargst l_varargsN(RskwargsR(R%titer_child_nodesR7RkRfRWRBRGRIRJRRtsortedRR;taccesses_kwargstaccesses_varargstaccesses_callerRR*t argumentsRER1ROR( RKR(Rtchildrent find_specialt func_frametoverridden_closure_varsRRRB((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfunction_scoping~sD            *      cCs|j|||}t|_|j}d|jjkrI|dg}n|jddj|||j|j ||j ||j |j ||j ||j|S(s/Dump the function def of a macro or call block.tloops l_loop=l_loopsdef macro(%s):s, (RR;RZRRWRGRRRR[RRRRR(RKR(RRR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt macro_bodys       cCsdjd|jD}t|dd}t|jdkrP|d7}n|jd||fx.|jD]#}|j|||jdqqW|jdt|j t|j t|j fdS( s<Dump the macro definition for the def created by macro_body.s, css|]}t|jVqdS(N(treprR*(RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys sR*it,s%Macro(environment, macro, %r, (%s), (s), %r, %r, %r)N( RRRR%tlenRtdefaultsR$R2RRR(RKR(Rt arg_tupleR*R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt macro_defs     cCs:d|j}|jdk r6|dt|j7}n|S(s.Return a human readable position for the node.sline %ds in N(RR*R%R(RKR(Rd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpositions cCs|dkstdt|j|j}ddlm}|jd|jddj|t sz|jdn|j rdpd }|j t j dk }xY|jt jD]E}|j|jkr|jd |j|jn||j|jPssdebug_info = %rt&css|]}d|VqdS(s%s=%sN((RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys Us(sself(sselfssuper(+R%tAssertionErrorRR)R*tjinja2.runtimeRRRRR,tfindRtExtendstfind_alltBlockRRRt ImportedNamet importnameRRtrsplitRURfRR1RXRYRRZRRERWRORRRRRR\R(RKR(RRVtexportedtenvenvt have_extendsR\timport_timpRtmoduletobjR*t block_frameRB((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Templates                      cCsd}|jrR|jrdS|jdkrR|jd|j|d7}qRn|jradpdd}|jd|j|f||j|jd||j|dS( s.Call a block and register it for the template.iNisif parent_template is None:scontext.derived(locals())tcontexts'for event in context.blocks[%r][0](%s):tevent( RXRRRRtscopedR*RR(RKR(RtlevelR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRtXs      cCs|js|jd|jn|jdkr|jsQ|jd|jn|jdd|jrwtq|jn|jd||j |j ||j d|j |jdt |j|jd |j|jrt|_n|jd 7_d S( sCalls the extender.s,cannot use extend from a non top-level scopeisif parent_template is not None:sraise TemplateRuntimeError(%r)sextended multiple timess+parent_template = environment.get_template(s, %r)s6for name, parent_block in parent_template.blocks.%s():s8context.blocks.setdefault(name, []).append(parent_block)iN(RXRRRRRRRRR$ttemplateRR*tdict_item_iterRYR1(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Extendsks.                cCs|jr|j|n|jr<|jd|jnd}t|jtjrt|jj t rud}qt|jj t t frd}qn't|jtj tjfrd}n|jd|||j|j||jd|j|jrY|j|jd|j|jd|j|jd |jn|jrr|jd n |jd |j|jd ||j|jr|jnd S(sHandles includes.stry:tget_or_select_templatet get_templatetselect_templatestemplate = environment.%s(s, %r)sexcept TemplateNotFound:Rselse:s]for event in template.root_render_func(template.new_context(context.parent, True, locals())):s*for event in template.module._body_stream:RN(t with_contextRtignore_missingRRR RRtConstR=R R6R7tTupletListR$RR*RR(RKR(Rt func_name((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Includes@                    cCs|jr|j|n|jd|j||jrP|jd|jn|jd|j|j||jd|j|jr|jdn |jd|jr|jj d r|jd|jn|j j |jd S( sVisit regular imports.sl_%s = scontext.vars[%r] = senvironment.get_template(s, %r).s+make_module(context.parent, True, locals())Rt_s!context.exported_vars.discard(%r)N( R RRRRXRR$RR*t startswithR]RN(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs     cCs|j||jd|j|j||jd|j|jrZ|jdn |jdg}g}x|jD]}t|tr|\}}n|}|j d||f|j d||j |j d|d|j |t |f|f|j |jrN|j||jd sN|j|qNn|jj|q}W|rt|d kr|d }|j d ||fq|j d djd|Dn|rt|d kr|j d|d q|j ddjtt |ndS(sVisit named imports.s-included_template = environment.get_template(s, %r).s!make_module(context.parent, True)Rs.l_%s = getattr(included_template, %r, missing)sif l_%s is missing:sGl_%s = environment.undefined(%r %% included_template.__name__, name=%r)sGthe template %%r (imported on %s) does not export the requested name %sRiiscontext.vars[%r] = l_%sscontext.vars.update({%s})s, css|]}d||fVqdS(s%r: l_%sN((RgR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys ss!context.exported_vars.discard(%r)s-context.exported_vars.difference_update((%s))N(RRR$RR*R RCR R6RRRRRRXRRR]RNRRR(RKR(Rt var_namestdiscarded_namesR*R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsP                c Cs|jdd"}|jr9|j|||dt}n|j}|j||jpydt|jdd#d$k}|js|j|d%}n-|jd||j |j |i}|r|jd|j j dnxN|j tjD]:}|jd kr|jdkr|jd |jqqW|j||jrt|j}|jd |nd|krdt|jdd&d'kr|jdd|j|n|jd||j|j||j|rdpd|r|jdk r|jd|j|j||jd|j|j||jd|jry|jdn|j|j||jd|j} |j|j| |jdn,|jr|jdn|j|j||jr |jdn|j|rdp"d| r|jdk r|j |jd|j|j||jd|j |jd|jdn|j |j |j!||jr|jd|n|j|jr"|jd||j |j |j||jn|js>|j"||n|jr|j#||j|j$|||jd |j|j||jd!|j%|ndS((NtexcludeRRRtonlyRs-def loop(reciter, loop_render_func, depth=0):sl_loop = missingRxs8Can't assign to special loop variable in for-loop targets%s = 1RR~s/l_loop = environment.undefined(%r, name='loop')s'loop' is undefined. the filter section of a loop as well as the else block don't have access to the special 'loop' variable of the current loop. Because there is no parent loop it's undefined. Happened in loop on %ssfor s, l_loop in LoopContext(s in t(s for treciters if (s))s, loop_render_func, depth):s):t:sif not tcontinueis%s = 0sif %s:sloop(s, loop)(siter(sbody(sloop(sloop(selse_stest(sloop(&Rt recursiveRR;RkRfRERRRR[RWRORRtNameRvR*RRRRRRR$RRR~R%RRQRRRRRRR( RKR(RRt loop_framet extended_loopRR*titeration_indicatort test_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR s                                        cCs|j}|jd||j|j||jd|j|j|j||j|j r|jd|j|j|j ||jndS(Nsif Rselse:( RlRR$R~RRRRRR(RKR(Rtif_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs       cCs|j||}|j|jre|jjdsN|jd|jn|jd|jn|jd|j|j|||jj |jdS(NRscontext.exported_vars.add(%r)scontext.vars[%r] = sl_%s = ( RRRXR*RRRRR]RN(RKR(Rt macro_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs  cCs~|jdd}|j|||}|jd|j|||j|||j|j|dt|j|dS(NRRs caller = tforward_caller(scall( RRRRRt visit_CallRR1R(RKR(RRt call_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs cCs|j}|j|j|j|}|j||j||j|j||j|||j |j ||j ||j ||dS(N( RkRfRRRR[RRRRrRRR(RKR(Rt filter_frameR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs    cCs$|j||j|j|dS(N(RR$R((RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExprStmts csjr|jrdSjjr4fd}nt}t}|jrijdjt}ng}x|j D]}y|j |j }Wn$t j k r|j |qynXyI|j jrt|dr|j}qt|}n||}Wn!tk r(|j |qynX|rVt|dtrV|dj |qy|j |gqyWt|dks|jdk rw|jdk rt|dkrjd|jnjd|jjnxL|D]D}t|trItt|} |jdkr5jd | q/j| d q|jdkrkjd |n j|d} |j jrjd n)|j jrjd n jd jjdk rjd| d7} nj||jd| |jdk rjd qqW|jdk rjjt|dkrjdpmdqnzg} g} xY|D]Q}t|tr| j t|jddq| j d| j |qWjd jtt| dd} jx| D]}j|d} |j jr_jd | d7} n&|j jrjd | d7} njjdk rjd| d7} nj||jd| d q Wjjd|rjndS(Ncstjj|S(N(R R)tfinalize(R(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytssif parent_template is None:t__html__iiis %s.append(s %s.extend((syield s, s6(context.eval_ctx.autoescape and escape or to_string)(sescape(s to_string(senvironment.finalize(Rs))t%s%%s%ss % (i( RRZR)R'R R;RRR1Rtas_constRVt ImpossibleRRthasattrR)R t ExceptionR R7RR[R%RRRRRR$Rtreplace(RKR(RR't outdent_laterRtchildtconstR>tvaltclosetformatRtidxtargument((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Outputs         !         + "               cCs|j||jr1|j}t|_n|}|j|j||jd|j|j||jrg|jD]}|j ds}|^q}}t |jdkrt t |j}|j d||fng|j dxJt|jD]9\}}|r!|jdn|jd||fqW|jd|rt |dkry|j d |d q|j d djtt|qndS( Ns = Riscontext.vars[%r] = l_%sscontext.vars.update({s, s%r: l_%ss})scontext.exported_vars.add(%r)is"context.exported_vars.update((%s))(RRXRQR8ttoplevel_assignmentsR$RRR(RRR RRt enumerateRRR(RKR(Rtassignment_frameRt public_namesR*R6((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR7s4         cCsY|jdkr.|jr.|jj|jn|jd|j|jj|jdS(NRxR(RvRXR9RNR*RR](RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRw^scCsE|j}t|tr.|jt|n|jt|dS(N(R=R R4RtstrR(RKR(RR3((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Constds cCsRy#|jt|j|jWn(tjk rM|jd|jnXdS(Ns8(context.eval_ctx.autoescape and Markup or identity)(%r)(RRR+RVRR,tdata(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_TemplateDataks # cCs||jdd}xCt|jD]2\}}|rE|jdn|j||q#W|j|dkrqdptddS(NRis, is,)R(RR:RR$(RKR(RR6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Tuplers cCsd|jdxCt|jD]2\}}|r?|jdn|j||qW|jddS(Nt[s, t](RR:RR$(RKR(RR6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_List{s  cCs|jdxft|jD]U\}}|r?|jdn|j|j||jd|j|j|qW|jddS(Nt{s, s: R(RR:RR$R?R=(RKR(RR6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Dicts  csfd}|S(Ncs|jjre|jjkre|jd|j|j||jd|j|j|nD|jd|j|j||jd|j|j||jddS(Ns$environment.call_binop(context, %r, s, Rs %s R(R)t sandboxedtintercepted_binopsRR$tlefttright(RKR(R(toperator(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRDs   ((RKt interceptableRD((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytbinops csfd}|S(Ncsz|jjrE|jjkrE|jd|j|j|n$|jd|j|j||jddS(Ns#environment.call_unop(context, %r, RR(R)RGtintercepted_unopsRR$R((RKR(R(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRDs ((RKRLRD((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytuaops t+t-t*t/s//s**R*tandRLtorsnot cCs|jjrd}n|jjr*d}nd}|jd|x.|jD]#}|j|||jdqKW|jddS(Ns;(context.eval_ctx.volatile and markup_join or unicode_join)t markup_joint unicode_joins%s((s, s))(RVRRRRR$(RKR(RRR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Concats    cCs;|j|j|x!|jD]}|j||qWdS(N(R$texprtops(RKR(Rtop((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_ComparescCs/|jdt|j|j|j|dS(Ns %s (Rt operatorsR[R$RY(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_OperandscCs8|jd|j|j||jd|jdS(Nsenvironment.getattr(s, %r)(RR$R(tattr(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Getattrs cCst|jtjrX|j|j||jd|j|j||jdnM|jd|j|j||jd|j|j||jddS(NRBRCsenvironment.getitem(s, R(R RRtSliceR$R(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Getitems   cCs|jdk r%|j|j|n|jd|jdk rW|j|j|n|jdk r|jd|j|j|ndS(NR(tstartR%R$RtstopR(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Slices  cCsk|j|j|jd|jjj|j}|dkr\|jd|j|jnt|dt r~|jdnDt|dt r|jdn"t|dt r|jdn|j dk r|j |j |nc|j j r|jd |j|jfn7|j jr6|jd |jn|jd |j|j|||jd dS( NRsno filter named %rt contextfilters context, tevalcontextfilterscontext.eval_ctx, tenvironmentfilters environment, sB(context.eval_ctx.autoescape and Markup(concat(%s)) or concat(%s))sMarkup(concat(%s))s concat(%s)R(RRoR*R)tgetR%RRRR;R(R$RVRR[RR(RKR(Rtfunc((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRrs(    cCs|j|j|jd|j|jjkrM|jd|j|jn|j|j||j|||jddS(NRsno test named %rR( RRpR*R)RRR$R(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRss cszfd}jdjjjdjjjd|jddS(NcsDjdk r"jjSjddjdS(Nsenvironment.undefined(%r)sRthe inline if-expression on %s evaluated to false and no else section was defined.(texpr2R%R$RR((RR(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt write_expr2s Rs if s else R(RR$texpr1R~(RKR(RRl((RR(RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CondExprs   cCsy|jjr|jdn |jd|j|j||rOidd6pRd}|j||||jddS(Nsenvironment.call(context, s context.call(RR(R)RGRR$R(R%R(RKR(RR"R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR#s  cCs+|j|jd|j|j|dS(Nt=(RR?R$R=(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_Keyword(scCs1|jd|j|j||jddS(NsMarkup(R(RR$RY(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafe.s cCs1|jd|j|j||jddS(Ns5(context.eval_ctx.autoescape and Markup or identity)(R(RR$RY(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafeIfAutoescape3s cCs|jd|jdS(Ns environment.(RR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_EnvironmentAttribute8scCs!|jd|j|jfdS(Nsenvironment.extensions[%r].%s(Rt identifierR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExtensionAttribute;scCs|j|j|jdS(N(RRR(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ImportedName>scCs|j|jdS(N(RR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_InternalNameAscCs|jddS(NR(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ContextReferenceDscCs|jd|dS(NR(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ContinueGscCs|jd|dS(Ntbreak(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt visit_BreakJscCsb|j}|j|j|j|}|j||j|j||j||dS(N(RkRfRRRRRR(RKR(Rt scope_frameR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRMs   cCsx|jD]}|jd|j|j|j|y|jj|j}Wn tjk rrt |j_ q Xt |j|j|q WdS(Nscontext.eval_ctx.%s = ( toptionsRR?R$R=R+RVRR,R1Rtsetattr(RKR(RtkeywordR3((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_EvalContextModifierUscCs|j}|jj}|jd||j||x!|jD]}|j||qFW|jj||jd|dS(Ns%s = context.eval_ctx.save()scontext.eval_ctx.revert(%s)(RRVtsaveRRRR$trevert(RKR(Rt old_ctx_namet safed_ctxR1((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ScopedEvalContextModifier`s N((VRRRSR%R;RLRRR[RRRRRRRRRRRRRRRRR1RRRRRRtRRRRRRRRRR&R8RRwR>R@RARDRFRMROt visit_Addt visit_Subt visit_Mult visit_Divtvisit_FloorDivt visit_Powt visit_Modt visit_Andtvisit_Ort visit_Post visit_Negt visit_NotRXR\R^R`RbReRrRsRnR#RpRqRrRsRuRvRwRxRyR{RRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR#ls 6            5    D   c  / +  5 ~   { '                                  N(3RTt itertoolsRRQRRRRtjinja2Rt jinja2.nodesRtjinja2.visitorRtjinja2.exceptionsRt jinja2.utilsRRR tjinja2._compatR R R R RRRR]R-R<RRR2RR%R;R.R:RER`RFRUt RuntimeErrorRARnR@ReR.RR#(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt sH4     %XV