ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ ǚPc@sdZddlmZmZddlZddlZddlZdefdYZde fdYZ defd YZ e Z d efd YZ d efd YZdefdYZdefdYZdefdYZdefdYZdZdZdZdZdZdZdZddZedZdZd Zd!Z ddd"Z!d#Z"dS($sdprovides runtime services for templates, including Context, Namespace, and various helper functions.i(t exceptionstutilNtContextcBseZdZdZdZedZedZdZdZ dZ dZ d Z d Z d Zd Zdd ZdZdZdZdZdZRS(sProvides runtime namespace, output buffer, and various callstacks for templates. See :ref:`runtime_toplevel` for detail on the usage of :class:`.Context`. cKss|g|_||_|j|_d|_d|_i|_tj t ||jdeZdZdZdZdZdZdZRS(cCs d|_dS(N(R t nextcaller(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRscCs|jrtptS(N(t _get_callertTruetFalse(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt __nonzero__scCs|dS(Ni((R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRAscCst|j|S(N(tgetattrRA(RR#((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt __getattr__scCs)|jp d}|j|d|_|S(N(R@R R(Rtframe((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt _push_frames  cCs|j|_dS(N(R)R@(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt _pop_frames(R<R=RRDRARFRHRI(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs      t UndefinedcBs eZdZdZdZRS(sRepresents an undefined value in a template. All template modules have a constant value ``UNDEFINED`` present which is an instance of this object. cCstddS(NRJ(t NameError(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt__str__scCstS(N(RC(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRDs(R<R=R>RLRD(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRJs t LoopStackcBs\eZdZdZdZdZedZdZdZ dZ dZ RS( sa stack for LoopContexts that implements the context manager protocol to automatically pop off the top of the stack on context exit cCs g|_dS(N(tstack(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRscCs|j||jS(N(t_pusht_top(Rtiterable((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt_enters cCs|j|jS(N(t_popRP(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt_exits cCs|jr|jdS|SdS(Ni(RN(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRPs  cCs |jjS(N(RNR)(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRSscCs8t|}|jr(|jd|_n|jj|S(Ni(t LoopContextRNR8R(RRQtnew((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyROs  cCstjddS(NsNo loop context is established(RtRuntimeException(RR#((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRFscCs t|jS(N(titerRP(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt__iter__s( R<R=R>RRRRTR?RPRSRORFRY(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRMs      RUcBseZdZdZdZejdZedZ edZ edZ edZ edZ d ZRS( sA magic loop variable. Automatically accessible in any ``% for`` block. See the section :ref:`loop_context` for usage notes. :attr:`parent` -> :class:`.LoopContext` or ``None`` The parent loop, if one exists. :attr:`index` -> `int` The 0-based iteration count. :attr:`reverse_index` -> `int` The number of iterations remaining. :attr:`first` -> `bool` ``True`` on the first iteration, ``False`` otherwise. :attr:`last` -> `bool` ``True`` on the last iteration, ``False`` otherwise. :attr:`even` -> `bool` ``True`` when ``index`` is even. :attr:`odd` -> `bool` ``True`` when ``index`` is odd. cCs||_d|_d|_dS(Ni(t _iterabletindexR R8(RRQ((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs  ccs,x%|jD]}|V|jd7_q WdS(Ni(RZR[(Rti((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRY scCs t|jS(N(R4RZ(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt__len__scCst||jdS(Ni(R4R[(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt reverse_indexscCs |jdkS(Ni(R[(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytfirstscCs|jt|dkS(Ni(R[R4(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytlastscCs|j S(N(todd(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyteven scCst|jdS(Ni(tboolR[(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRa$scGs*|stdn||jt|S(s5Cycle through values as the loop progresses. s(You must provide values to cycle through(t ValueErrorR[R4(Rtvalues((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytcycle(s(R<R=R>RRYRtmemoized_instancemethodR]R?R^R_R`RbRaRf(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRUs  t_NSAttrcBseZdZdZRS(cCs ||_dS(N(t_NSAttr__parent(RR8((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyR1scCsQ|j}x5|r@t|j|r4t|j|S|j}q Wt|dS(N(RithasattrtmoduleREtinheritstAttributeError(RR#tns((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRF3s    (R<R=RRF(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRh0s t NamespacecBseZdZd d ed dZd Zd Zd Zd Z d Z d Z d Z e jdZdZdZdZedZdZdZd Zd ZRS( sProvides 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: .. sourcecode:: mako ${some_namespace.foo(x, y, z)} :class:`.Namespace` also contains several built-in attributes described here. cCsY||_||_||_|dk rUtg|D]}|j|f^q1|_ndS(N(tnametcontextRlR tdictt func_namet callables(RRpRqRtRlt populate_selft calling_uriR2((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRLs     cCs t|S(sAccess 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`. (Rh(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytattrs cCsk||f}||jjkr,|jj|St||jjd|d|j}||jj|<|SdS(s]Return a :class:`.Namespace` corresponding to the given ``uri``. If the given ``uri`` is a relative URI (i.e. it does not contain a 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 evaluated 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 templateuriRvN(RqR tTemplateNamespaceR3t _templateuri(RturiR#Rn((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt get_namespaces  cCst|j||jS(sReturn 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_templateRqRz(RR{((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt get_templatescKs|jj||S(sReturn 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>``. (tcacheR-(RR#R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt get_cacheds cCs |jjS(sReturn the :class:`.Cache` object referenced by this :class:`.Namespace` object's :class:`.Template`. (ttemplateR(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRscKst|j||j|dS(s$Include a file at the given ``uri``.N(t _include_fileRqRz(RR{R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt include_filescCs^xW|D]O}|dkrCx:|jD]\}}|||R RBRRtRkRRqtfilenameR{RzRtmemoized_propertyRwR|R~RR?RRRRRF(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRo<s&         RycBsheZdZddddeddZedZedZedZ dZ dZ RS(s@A :class:`.Namespace` specific to a :class:`.Template` instance.c Cs||_||_||_|dk rUtg|D]} | j| f^q1|_n|dk rt||||_|jj j |_ n3|dk r||_|j j |_ n t d|rt ||jd|\} } ndS(Ns 'template' argument is required.tself_ns(RpRqRlR RrRsRtR}RRkt _template_uriRzt TypeErrort_populate_self_namespace( RRpRqRRxRtRlRuRvR2t lclcallablet lclcontext((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs     .      cCs |jjS(sThe Python module referenced by this :class:`.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. (RRk(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRk s cCs |jjS(shThe path of the filesystem file used for this :class:`.Namespace`'s module or template. (RR(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRscCs |jjS(sThe URI for this :class:`.Namespace`'s template. I.e. whatever was sent to :meth:`.TemplateLookup.get_template()`. This is the equivalent of :attr:`.Template.uri`. (RR{(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyR{s c#spjr2x&jD]}|j|fVqWnfd}x(jjjD]}|||fVqQWdS(Ncs%jj|}tj|jS(N(Rt_get_def_callableRR Rq(R#t callable_(R(s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyR-+s(RtRRkt_exports(RR#R-R((Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyR's  cCs||jkr|j|}ns|jj|r[|jj|}tj||j}n7|jryt|j|}nt d|j |ft ||||S(Ns!Namespace '%s' has no member '%s'( RtRthas_defRRR RqRlRERmRpR(RR#RR((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRF1s N( R<R=R>R RBRR?RkRR{RRF(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRys  tModuleNamespacecBsDeZdZddeddZedZdZdZ RS(s;A :class:`.Namespace` specific to a Python module instance.c Cs||_||_||_|dk rUtg|D]}|j|f^q1|_nt|} x*|jddD]} t | | } quW| |_ dS(Nt.i( RpRqRlR RrRsRtt __import__tsplitRERk( RRpRqRkRtRlRuRvR2tmodttoken((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRDs    . cCs |jjS(shThe path of the filesystem file used for this :class:`.Namespace`'s module or template. (Rkt__file__(R((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRRsc#sjr2x&jD]}|j|fVqWnfd}x;tjD]*}|ddkrQ|||fVqQqQWdS(Ncs%tj|}tj|jS(N(RERkRR Rq(R#R(R(s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyR-]sit_(RttdirRk(RR#R-R((Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRYs cCs||jkr|j|}nst|j|r[t|j|}tj||j}n7|jryt|j|}ntd|j |ft ||||S(Ns!Namespace '%s' has no member '%s'( RtRjRkRERR RqRlRmRpR(RR#RR((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRFds N( R<R=R>R RBRR?RRRF(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRAs   csfd}|S(sApply a caller_stack compatibility decorator to a plain Python function. See the example in :ref:`namespaces_python_modules`. cs6|jjz|||SWd|jjXdS(N(RRHRI(RqtargsR(tfunc(s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytwrap_stackframe{s ((RR((Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytsupports_callersscOsSt|stjdn|jz|||Wd|j}X|jS(sExecute 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(tcallableRRWR+R,tgetvalue(RqRRRR'((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs    csfd}|S(Ncsfd}|S(NcsPfd}yjd|_Wntk r9nX|||S(Ncs||S(N((Rtkw(Rqt render_fn(s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytysi(R<R(RqRRR(tfnR(Rqs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytgos  ((RR(R(Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pytdecorate_renders ((RR((Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt_decorate_toplevels csfd}|S(Ncs"|fd}|S(Ncs||S(N((RR(Rqtdec(s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs((RR(RqR(Rs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs ((RqRR((RqRs=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyt_decorate_inlinescKsMt|||}t|j|\}}||t||j|dS(sPlocate the template from the given uri and include it in the current output.N(R}RR;t_kwargs_for_includeR(RqR{RvRRRtctx((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyRs  c Cs|d krd St|||}|d}|}x|jd k rP|j}q5W|ji|d6}td|j|d|dt|_|j|jd<|jdtmakoRRR!tinspectRtobjectRtlistRRJt UNDEFINEDRMRURhRoRyRRRRRRRR}R RRCRRRRRR(((s=/opt/alt/python27/lib/python2.7/site-packages/mako/runtime.pyts4$ 'A R2