Ñò -!Lc@sEdZddklZlZddkZddkZddkZdefd„ƒYZde fd„ƒYZ defd „ƒYZ e ƒZ d efd „ƒYZ d efd „ƒYZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zed„Zd„Zd„Zd„Zddd„Zd„ZdS(sdprovides runtime services for templates, including Context, Namespace, and various helper functions.iÿÿÿÿ(t exceptionstutilNtContextcBs¶eZdZd„Zed„ƒZed„ƒZd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zdd „Zd „Zd„Zd„Zd„Zd„ZRS(sPprovides runtime namespace, output buffer, and various callstacks for templates.c s’|gˆ_|ˆ_tiiƒˆ_ˆii|ƒ|iƒˆ_dˆ_ dˆ_ hˆ_ ‡fd†ˆidsRtcaller(t _buffer_stackt_origt __builtin__t__dict__tcopyt_datatupdatet_kwargstNonet_with_templatet_outputting_as_unicodet namespacest CallerStackt caller_stack(Rtbuffertdata((Rs0/usr/lib/python2.6/site-packages/mako/runtime.pyt__init__s     cCs |iiS(N(Rtlookup(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRscCs |iiƒS(N(RR(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR"scCs|ii|ƒdS(N(Rtappend(RR ((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt push_caller&scCs|id=dS(Niÿÿÿÿ(R(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt pop_caller)scCs |iiƒS(N(Rtkeys(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR,scCs |i|S(N(R(Rtkey((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt __getitem__/scCs#tiƒ}|ii|ƒ|iS(sMpush a capturing buffer onto this Context and return the new Writer function.(RtFastEncodingBufferR Rtwrite(Rtbuf((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _push_writer2s cCs#|iiƒ}||idifS(s~pop the most recent capturing buffer from this Context and return the current writer after the pop. iÿÿÿÿ(R tpopR#(RR$((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt_pop_buffer_and_writer9scCs|iƒdS(s*push a capturing buffer onto this Context.N(R%(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _push_bufferBscCs |iiƒS(s7pop the most recent capturing buffer from this Context.(R R&(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _pop_bufferGscCs|ii||ƒS(N(Rtget(RR tdefault((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR*LscCs|idi|ƒdS(s:write a string to this Context's underlying output buffer.iÿÿÿÿN(R R#(Rtstring((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR#OscCs|idiS(s"return the current writer functioniÿÿÿÿ(R R#(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pytwriterTscCsytitƒ}|i|_|iiƒ|_|i|_|i|_|i|_|i|_|i |_ |i |_ |S(N( Rt__new__R RRR RRRRR(Rtc((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt_copyYs       cCs8t|ƒdjo|S|iƒ}|ii|ƒ|S(sdcreate a new Context with a copy of this Context's current state, updated with the given dictionary.i(tlenR0RR(RtdR/((s0/usr/lib/python2.6/site-packages/mako/runtime.pytlocals_ds  cCsI|iƒ}|i}|iddƒ|iddƒ|iddƒ|S(sScreate a new copy of this Context with tokens related to inheritance state removed.RtparenttnextN(R0RR&R(RR/R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt_clean_inheritance_tokensks   N(t__name__t __module__t__doc__RtpropertyRRRRRR!R%R'R(R)RR*R#R-R0R3R6(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR s$            RcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs d|_dS(N(Rt nextcaller(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRuscCs|iƒotptS(N(t _get_callertTruetFalse(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt __nonzero__wscCs|dS(Niÿÿÿÿ((R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR<yscCst|iƒ|ƒS(N(tgetattrR<(RR ((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt __getattr__{scCs$|i|ipdƒd|_dS(N(RR;R(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _push_frame}scCs|iƒ|_dS(N(R&R;(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _pop_frame€s(R7R8RR?R<RARBRC(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRts      t UndefinedcBs eZdZd„Zd„ZRS(s,represents an undefined value in a template.cCstdƒ‚dS(NRD(t NameError(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt__str__†scCstS(N(R>(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR?ˆs(R7R8R9RFR?(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRD„s t_NSAttrcBseZd„Zd„ZRS(cCs ||_dS(N(t_NSAttr__parent(RR4((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRŽscCsU|i}x9|o1t|i|ƒot|i|ƒS|i}q Wt|ƒ‚dS(N(RHthasattrtmoduleR@tinheritstAttributeError(RR tns((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRAs (R7R8RRA(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRGs t NamespacecBs¶eZdZdddddedd„Zed„ƒZed„ƒZed„ƒZ ed„ƒZ d„Z d„Z d„Z ed „ƒZd „Zd „Zd „Zd „ZRS(s~provides access to collections of rendering methods, which can be local, from other templates, or from imported modulesc  Csh||_|dj oFt|ƒ} x*|idƒdD]} t| | ƒ} q6W| |_n d|_|dj o+t||| ƒ|_|iii |_ n0||_|idj o|iii |_ n||_ ||_ |dj o7t g} |D]} | | i| fqù~ ƒ|_n d|_|o2|idj o"t||id|ƒ\}}ndS(Nt.itself_ns(tnameRt __import__tsplitR@t_modulet_lookup_templatettemplateRJt _template_urit _templateuritcontextRKtdictt func_namet callablest_populate_self_namespace(RRQRYRJRVt templateuriR\RKt populate_selft calling_uritmodttokent_[1]R/t lclcallablet lclcontext((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRs*          7 cCs|ip |iiS(N(RTRVRJ(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRJ¹scCs#|io |iiS|iiSdS(N(RTt__file__RVtfilename(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRg½s  cCs |iiS(N(RVturi(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRhÄscCs*t|dƒpt|ƒ|_n|iS(Nt_attr(RIRGRi(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pytattrÈscCsp||f}|iii|ƒo|ii|St||iiƒd|d|iƒ}||ii|<|SdS(s˜return a namespace corresponding to the given template uri. if a relative uri, it is adjusted to that of the template of this namespaceR^R`N(RYRthas_keyRNR0RX(RRhR RM((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt get_namespaceÎs  'cCst|i||iƒS(N(RURYRX(RRh((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt get_templateÚscKsÌ|io¯|iip)|iddƒ}|o|ƒSdSn|iio|id|iiƒn|iio|id|iiƒn|iio|id|iiƒq¹n|ii||S(Nt createfunctdata_dirttypeturl( RVt cache_enabledR*Rt cache_dirt setdefaultt cache_typet cache_urltcache(RR RRn((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt get_cachedÝs     cCs |iiS(N(RVRw(R((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRwîscKst|i||i|dS(sinclude a file at the given uriN(t _include_fileRYRX(RRhR((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt include_fileòscCs`xY|D]Q}|djo+x;|iƒD]\}}|||‡fd†}x,ˆiiiD]}|||ƒfVq]WnˆioS‡fd†}xAtˆiƒD],}|ddjo|||ƒfVq¥q¥WndS(Ncs"ˆii|ƒ‰‡‡fd†S(Ncsˆˆi||ŽS((RY(RR(Rt callable_(s0/usr/lib/python2.6/site-packages/mako/runtime.pyRs(RVt_get_def_callable(R (R(R‚s0/usr/lib/python2.6/site-packages/mako/runtime.pyR*scs"tˆi|ƒ‰‡‡fd†S(Ncsˆˆi||ŽS((RY(RR(RR‚(s0/usr/lib/python2.6/site-packages/mako/runtime.pyR s(R@RT(R (R(R‚s0/usr/lib/python2.6/site-packages/mako/runtime.pyR* sit_(R\RVRJt_exportsRTtdir(RR R*R((Rs0/usr/lib/python2.6/site-packages/mako/runtime.pyR|þs    csäˆio|ˆijo ˆi|Sˆio6ˆii|ƒo#ˆii|ƒ‰‡‡fd†Sˆio6tˆi|ƒo#tˆi|ƒ‰‡‡fd†Sˆidj otˆi|ƒSt dˆi |fƒ‚dS(Ncsˆˆi||ŽS((RY(RR(RR‚(s0/usr/lib/python2.6/site-packages/mako/runtime.pyRscsˆˆi||ŽS((RY(RR(RR‚(s0/usr/lib/python2.6/site-packages/mako/runtime.pyRss!Namespace '%s' has no member '%s'( R\RVthas_defRƒRTRIR@RKRRLRQ(RR ((RR‚s0/usr/lib/python2.6/site-packages/mako/runtime.pyRAs N(R7R8R9RR=RR:RJRgRhRjRlRmRxRwRzRR|RA(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRN™s"     cs‡fd†}|S(sHapply a caller_stack compatibility decorator to a plain Python function.cs6|iiƒzˆ|||ŽSWd|iiƒXdS(N(RRBRC(RYRR(tfunc(s0/usr/lib/python2.6/site-packages/mako/runtime.pytwrap_stackframe#s ((RˆR‰((Rˆs0/usr/lib/python2.6/site-packages/mako/runtime.pytsupports_caller scOsUt|ƒptidƒ‚n|iƒz|||ŽWd|iƒ}X|iƒS(sCexecute the given template def, capturing the output into a buffer.s[capture() function expects a callable as its argument (i.e. capture(func, *args, **kwargs))N(tcallableRtRuntimeExceptionR(R)tgetvalue(RYR‚RRR$((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR+s    cs‡fd†}|S(Ncs‡‡fd†}|S(Nc sR‡‡fd†}yˆid|_Wntj onXˆ|ƒˆ||ŽS(Ncsˆˆ||ŽS(N((Rtkw(RYt render_fn(s0/usr/lib/python2.6/site-packages/mako/runtime.pyty=si(R7t TypeError(RYRRŽR(Rtfn(RYs0/usr/lib/python2.6/site-packages/mako/runtime.pytgo<s ((RR“(R’(Rs0/usr/lib/python2.6/site-packages/mako/runtime.pytdecorate_render;s ((R’R”((R’s0/usr/lib/python2.6/site-packages/mako/runtime.pyt_decorate_toplevel:s cs‡‡fd†}|S(Ncs"ˆ|ƒ‰‡‡fd†}|S(Ncsˆˆ||ŽS(N((RRŽ(tdecRY(s0/usr/lib/python2.6/site-packages/mako/runtime.pyR“Ks((RR“(RYR’(R–s0/usr/lib/python2.6/site-packages/mako/runtime.pyR”Is ((RYR’R”((R’RYs0/usr/lib/python2.6/site-packages/mako/runtime.pyt_decorate_inlineHscKsMt|||ƒ}t|iƒ|ƒ\}}||t||i|dS(sLlocate the template from the given uri and include it in the current output.N(RUR]R6t_kwargs_for_includeR (RYRhR`RRVR‚tctx((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRyPsc Cs)|d jod St|||ƒ}|d}|}x|id j o |i}q7W|ih|d6ƒ}td|i|d|dtƒ|_|i|id<|idRR@RJR‚( RYRhR`RVRPtihReR‚trettgen_ns((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt _inherit_fromWs(  %   cCs|ii}|djotid|iiƒ‚n|i||ƒ}y|i|ƒSWn-tij o}tit |ƒƒ‚nXdS(Ns.Template '%s' has no TemplateLookup associated( RRRRtTemplateLookupExceptionRht adjust_uriRmtTopLevelLookupExceptiontstr(RYRht relativetoRte((s0/usr/lib/python2.6/site-packages/mako/runtime.pyRUos  cCs|djo&td|i|d|dtƒ}n||id<|idRRIRJR›R‚(RYRVRPRž((s0/usr/lib/python2.6/site-packages/mako/runtime.pyR]ys & cCs«|otidtƒ}n?|io(tid|d|id|iƒ}n tiƒ}t||}||_||_t ||||t ||ƒŽ|i ƒi ƒS(sZcreate a Context and return the string output of the given template and template callable.tunicodetencodingterrors( RR"R=toutput_encodingtencoding_errorstStringIORRRt_render_contextt_kwargs_for_callableR)R(RVR‚RRt as_unicodeR$RY((s0/usr/lib/python2.6/site-packages/mako/runtime.pyt_renderƒs      cCs´ti|ƒ}|do|S|dg}|dd!D]}|dj o ||q8q8~}h}xG|D]?}|djo,||jo||jo||||R°R®R˜R­R¹R¿(((s0/usr/lib/python2.6/site-packages/mako/runtime.pyts,$h  ‡