Ñò žòœMc@sqdZddklZlZddkZddkZddkZdefd„ƒYZde fd„ƒYZ defd „ƒYZ e ƒZ d efd „ƒYZ d efd „ƒYZdefd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zed„Zd„Zd„Zd„Zddd„Zd„Z dS( 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(s±Provides runtime namespace, output buffer, and various callstacks for templates. See :ref:`runtime_toplevel` for detail on the usage of :class:`.Context`. cKss|g|_||_|iƒ|_d|_d|_h|_ti t |ƒ|ideZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs d|_dS(N(R t nextcaller(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRœscCs|iƒotptS(N(t _get_callertTruetFalse(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt __nonzero__žscCs|dS(Niÿÿÿÿ((R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR: scCst|iƒ|ƒS(N(tgetattrR:(RR((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt __getattr__¢scCs$|i|ipdƒd|_dS(N(RR9R (R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt _push_frame¤scCs|iƒ|_dS(N(R"R9(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt _pop_frame§s(R5R6RR=R:R?R@RA(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR›s      t UndefinedcBs eZdZd„Zd„ZRS(s¨Represents an undefined value in a template. All template modules have a constant value ``UNDEFINED`` present which is an instance of this object. cCstdƒ‚dS(NRB(t NameError(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt__str__³scCstS(N(R<(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR=µs(R5R6R7RDR=(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRB«s t_NSAttrcBseZd„Zd„ZRS(cCs ||_dS(N(t_NSAttr__parent(RR1((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR»scCsU|i}x9|o1t|i|ƒot|i|ƒS|i}q Wt|ƒ‚dS(N(RFthasattrtmoduleR>tinheritstAttributeError(RRtns((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR?½s (R5R6RR?(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyREºs t NamespacecBs­eZdZd d ed d„Zd Zd Zd Zd Z d Z d Z d Z e id„ƒZd„Zd„Zd„Zed„ƒZd„Zd„Zd „Zd „ZRS( s‡Provides access to collections of rendering methods, which can be local, from other templates, or from imported modules. To access a particular rendering method referenced by a :class:`.Namespace`, use plain attribute access:: ${some_namespace.foo(x, y, z)} :class:`.Namespace` also contains several built-in attributes described here. c Csc||_||_||_|dj o7tg}|D]}||i|fq6~ƒ|_ndS(N(tnametcontextRIR tdictt func_namet callables( RRMRNRQRIt populate_selft calling_urit_[1]R+((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRÔs     cCs t|ƒS(süAccess module level attributes by name. This accessor allows templates to supply "scalar" attributes which are particularly handy in inheritance relationships. See the example in :ref:`inheritance_toplevel`. (RE(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pytattrs cCsm||f}||iijo|ii|St||iiƒd|d|iƒ}||ii|<|SdS(sOReturn a :class:`.Namespace` corresponding to the given uri. If the given uri is a relative uri (i.e. it does not contain ia leading slash ``/``), the uri is adjusted to be relative to the uri of the namespace itself. This method is therefore mostly useful off of the built-in ``local`` namespace, described in :ref:`namespace_local` In most cases, a template wouldn't need this function, and should instead use the ``<%namespace>`` tag to load namespaces. However, since all ``<%namespace>`` tags are evaulated before the body of a template ever runs, this method can be used to locate namespaces using expressions that were generated within the body code of the template, or to conditionally use a particular namespace. t templateuriRSN(RNR tTemplateNamespaceR,t _templateuri(RturiRRK((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt get_namespaces  cCst|i||iƒS(s¯Return a :class:`.Template` from the given uri. The uri resolution is relative to the uri of this :class:`.Namespace` object's :class:`.Template`. (t_lookup_templateRNRX(RRY((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt get_template9scKsÌ|io¯|iip)|iddƒ}|o|ƒSdSn|iio|id|iiƒn|iio|id|iiƒn|iio|id|iiƒq¹n|ii||S(s”Return a value from the :class:`.Cache` referenced by this :class:`.Namespace` object's :class:`.Template`. The advantage to this method versus direct access to the :class:`.Cache` is that the configuration parameters declared in ``<%page>`` take effect here, thereby calling up the same configured backend as that configured by ``<%page>``. t createfunctdata_dirttypeturlN( ttemplatet cache_enabledR&R t cache_dirt setdefaultt cache_typet cache_urltcache(RRRR]((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt get_cachedBs     cCs |iiS(s„Return the :class:`.Cache` object referenced by this :class:`.Namespace` object's :class:`.Template`. (RaRg(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRg^scKst|i||i|dS(sInclude a file at the given uriN(t _include_fileRNRX(RRYR((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt include_filegscCs`xY|D]Q}|djo+x;|iƒD]\}}|||(RR/tltidenttktv((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt _populatels  ccs8|io*x'|iD]}||i|fVqWndS(N(RQ(RR((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRlts  cCsn||ijo|i|}n:|iot|i|ƒ}ntd|i|fƒ‚t|||ƒ|S(Ns!Namespace '%s' has no member '%s'(RQRIR>RJRMtsetattr(RRtval((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR?ys N((R5R6R7R R;RRQRHRaRNtfilenameRYRXRtmemoized_propertyRURZR\RhR8RgRjRqRlR?(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRLÆs&          RWcBsheZdZddddedd„Zed„ƒZed„ƒZed„ƒZ d„Z d„Z RS(s@A :class:`.Namespace` specific to a :class:`.Template` instance.c Csù||_||_||_|dj o7tg} |D]} | | i| fq6~ ƒ|_n|dj o+t|||ƒ|_|ii i |_ n6|dj o||_|i i |_ n t dƒ‚|o"t ||id|ƒ\} } ndS(Ns 'template' argument is required.tself_ns(RMRNRIR RORPRQR[RaRHt _template_uriRXt TypeErrort_populate_self_namespace( RRMRNRaRVRQRIRRRSRTR+t lclcallablet lclcontext((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRˆs     7      cCs |iiS(sìThe Python module referenced by this Namespace. If the namespace references a :class:`.Template`, then this module is the equivalent of ``template.module``, i.e. the generated module for the template. (RaRH(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRH s cCs |iiS(s^The path of the filesystem file used for this Namespace's module or template. (RaRt(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRt«scCs |iiS(s¶The uri for this Namespace's template. I.e. whatever was sent to :meth:`.TemplateLookup.get_template()`. This is the equivalent of :attr:`Template.uri`. (RaRY(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRY²s c#srˆio*x'ˆiD]}|ˆi|fVqWn‡fd†}x(ˆiiiD]}|||ƒfVqSWdS(Ncs%ˆii|ƒ}ti|ˆiƒS(N(Rat_get_def_callableRR RN(Rt callable_(R(s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR&Ás(RQRaRHt_exports(RRR&Ro((Rs2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRl½s  cCs¬||ijo|i|}nx|ii|ƒo+|ii|ƒ}ti||iƒ}n:|iot|i|ƒ}nt d|i |fƒ‚t |||ƒ|S(Ns!Namespace '%s' has no member '%s'( RQRathas_defR|RR RNRIR>RJRMRr(RRRsR}((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR?Çs N( R5R6R7R R;RR8RHRtRYRlR?(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRW…s  tModuleNamespacecBsDeZdZddedd„Zed„ƒZd„Zd„Z RS(s;A :class:`.Namespace` specific to a Python module instance.c Cs¥||_||_||_|dj o7tg}|D]} || i| fq6~ƒ|_nt|ƒ} x*|idƒdD]} t | | ƒ} qW| |_ dS(Nt.i( RMRNRIR RORPRQt __import__tsplitR>RH( RRMRNRHRQRIRRRSRTR+tmodttoken((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRÚs    7 cCs |iiS(s^The path of the filesystem file used for this Namespace's module or template. (RHt__file__(R((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRtèsc#s‡ˆio*x'ˆiD]}|ˆi|fVqWn‡fd†}x=tˆiƒD],}|ddjo|||ƒfVqSqSWdS(Ncs%tˆi|ƒ}ti|ˆiƒS(N(R>RHRR RN(RR}(R(s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR&ósit_(RQtdirRH(RRR&Ro((Rs2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRlïs  cCs¬||ijo|i|}nxt|i|ƒo+t|i|ƒ}ti||iƒ}n:|iot|i|ƒ}ntd|i |fƒ‚t |||ƒ|S(Ns!Namespace '%s' has no member '%s'( RQRGRHR>RR RNRIRJRMRr(RRRsR}((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR?ús N( R5R6R7R R;RR8RtRlR?(((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR€×s   cs‡fd†}|S(sŽApply a caller_stack compatibility decorator to a plain Python function. See the example in :ref:`namespaces_python_modules`. cs6|iiƒzˆ|||ŽSWd|iiƒXdS(N(RR@RA(RNtargsR(tfunc(s2/usr/lib/python2.6/vendor-packages/mako/runtime.pytwrap_stackframes ((RŠR‹((RŠs2/usr/lib/python2.6/vendor-packages/mako/runtime.pytsupports_caller scOsUt|ƒptidƒ‚n|iƒz|||ŽWd|iƒ}X|iƒS(s‰Execute the given template def, capturing the output into a buffer. See the example in :ref:`namespaces_python_modules`. s[capture() function expects a callable as its argument (i.e. capture(func, *args, **kwargs))N(tcallableRtRuntimeExceptionR$R%tgetvalue(RNR}R‰RR ((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRs    cs‡fd†}|S(Ncs‡‡fd†}|S(Nc sR‡‡fd†}yˆid|_Wntj onXˆ|ƒˆ||ŽS(Ncsˆˆ||ŽS(N((R‰tkw(RNt render_fn(s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyty0si(R5Rx(RNR‰RR’(R‘tfn(RNs2/usr/lib/python2.6/vendor-packages/mako/runtime.pytgo/s ((R‘R”(R“(R‘s2/usr/lib/python2.6/vendor-packages/mako/runtime.pytdecorate_render.s ((R“R•((R“s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt_decorate_toplevel-s cs‡‡fd†}|S(Ncs"ˆ|ƒ‰‡‡fd†}|S(Ncsˆˆ||ŽS(N((R‰R(tdecRN(s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR”>s((R‘R”(RNR“(R—s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR•<s ((RNR“R•((R“RNs2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt_decorate_inline;scKsMt|||ƒ}t|iƒ|ƒ\}}||t||i|dS(sPlocate the template from the given uri and include it in the current output.N(R[RyR4t_kwargs_for_includeR(RNRYRSRRaR}tctx((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyRiCs  c Cs)|d jod St|||ƒ}|d}|}x|id j o |i}q7W|ih|d6ƒ}td|i|d|dtƒ|_|i|id<|idRHR}( RNRYRSRaRvtihR{R}trettgen_ns((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyt _inherit_fromMs.       cCs|ii}|djotid|iiƒ‚n|i||ƒ}y|i|ƒSWn-tij o}tit |ƒƒ‚nXdS(Ns.Template '%s' has no TemplateLookup associated( R RR RtTemplateLookupExceptionRYt adjust_uriR\tTopLevelLookupExceptiontstr(RNRYt relativetoRte((s2/usr/lib/python2.6/vendor-packages/mako/runtime.pyR[js  cCs|djo&td|i|d|dtƒ}n||id<|ids0$Ž  ¿R2