PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  Qc@sdZddlmZmZmZddlmZddlZddlZddl Z de fdYZ de fdYZ d e fd YZeZd e fd YZd e fdYZde fdYZde fdYZdefdYZdefdYZdZdZdZdZdZdZdZddZedZ d Z!d!Z"d"Z#ddd#Z$d$Z%dS(%sdprovides runtime services for templates, including Context, Namespace, and various helper functions.i(t exceptionstutiltcompat(tcompat_builtinsNtContextcBseZdZdZdZedZedZdZdZ 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 ||jdR?RRDRCRERIRKRL(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRs      t UndefinedcBs)eZdZdZdZdZRS(sRepresents an undefined value in a template. All template modules have a constant value ``UNDEFINED`` present which is an instance of this object. cCstddS(NRM(t NameError(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt__str__scCs |jS(N(RC(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRDscCstS(N(RG(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRCs(R>R?R@RORDRC(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRMs  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((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRscCs|j||jS(N(t_pusht_top(Rtiterable((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt_enters cCs|j|jS(N(t_popRS(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt_exits cCs|jr|jdS|SdS(Ni(RQ(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRSs  cCs |jjS(N(RQR+(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRVscCs8t|}|jr(|jd|_n|jj|S(Ni(t LoopContextRQR:R(RRTtnew((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRRs  cCstjddS(NsNo loop context is established(RtRuntimeException(RR%((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRIscCs t|jS(N(titerRS(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt__iter__s( R>R?R@RRURWRARSRVRRRIR\(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRPs      RXcBseZdZdZdZejdZedZ 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 R:(RRT((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRs  ccs,x%|jD]}|V|jd7_q WdS(Ni(R]R^(Rti((s0/usr/lib/python2.7/site-packages/mako/runtime.pyR\scCs t|jS(N(R6R](R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt__len__scCst||jdS(Ni(R6R^(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt reverse_index scCs |jdkS(Ni(R^(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pytfirst$scCs|jt|dkS(Ni(R^R6(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pytlast(scCs|j S(N(todd(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyteven,scCst|jdS(Ni(tboolR^(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRd0scGs*|stdn||jt|S(s5Cycle through values as the loop progresses. s(You must provide values to cycle through(t ValueErrorR^R6(Rtvalues((s0/usr/lib/python2.7/site-packages/mako/runtime.pytcycle4s(R>R?R@RR\Rtmemoized_instancemethodR`RARaRbRcReRdRi(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRXs  t_NSAttrcBseZdZdZRS(cCs ||_dS(N(t_NSAttr__parent(RR:((s0/usr/lib/python2.7/site-packages/mako/runtime.pyR=scCsQ|j}x5|r@t|j|r4t|j|S|j}q Wt|dS(N(RlthasattrtmoduleRHtinheritstAttributeError(RR%tns((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRI?s    (R>R?RRI(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRk<s 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(tnametcontextRoR tdictR>t callables(RRsRtRvRot populate_selft calling_uriR4((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRXs     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. .. seealso:: :ref:`inheritance_attr` :ref:`namespace_attr_for_includes` (Rk(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pytattrscCsk||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 templateuriRxN(RtRtTemplateNamespaceR5t _templateuri(RturiR%Rq((s0/usr/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_templateRtR|(RR}((s0/usr/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((s0/usr/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((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRscKst|j||j|dS(s$Include a file at the given ``uri``.N(t _include_fileRtR|(RR}R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyt include_filescCs^xW|D]O}|dkrCx:|jD]\}}|||R?R@R RFRRvRnRRttfilenameR}R|Rtmemoized_propertyRyR~RRRARRRRRI(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRrHs&         R{cBsheZdZddddeddZedZedZedZ 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(RsRtRoR RuR>RvRRRnt _template_uriR|t TypeErrort_populate_self_namespace( RRsRtRRzRvRoRwRxR4t lclcallablet lclcontext((s0/usr/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. (RRn(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRns cCs |jjS(shThe path of the filesystem file used for this :class:`.Namespace`'s module or template. (RR(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyR&scCs |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((s0/usr/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_callableRRRt(R%t callable_(R(s0/usr/lib/python2.7/site-packages/mako/runtime.pyR/<s(RvRRnt_exports(RR%R/R((Rs0/usr/lib/python2.7/site-packages/mako/runtime.pyR8s  cCs||jkr|j|}ns|jj|r[|jj|}tj||j}n7|jryt|j|}nt d|j |ft ||||S(Ns!Namespace '%s' has no member '%s'( RvRthas_defRRRRtRoRHRpRsR(RR%RR((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRIBs N( R>R?R@R RFRRARnRR}RRI(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyR{s  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( RsRtRoR RuR>Rvt __import__tsplitRHRn( RRsRtRnRvRoRwRxR4tmodttoken((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRUs    . cCs |jjS(shThe path of the filesystem file used for this :class:`.Namespace`'s module or template. (Rnt__file__(R((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRcsc#sjr2x&jD]}|j|fVqWnfd}x;tjD]*}|ddkrQ|||fVqQqQWdS(Ncs%tj|}tj|jS(N(RHRnRRRt(R%R(R(s0/usr/lib/python2.7/site-packages/mako/runtime.pyR/nsit_(RvtdirRn(RR%R/R((Rs0/usr/lib/python2.7/site-packages/mako/runtime.pyRjs cCs||jkr|j|}nst|j|r[t|j|}tj||j}n7|jryt|j|}ntd|j |ft ||||S(Ns!Namespace '%s' has no member '%s'( RvRmRnRHRRRtRoRpRsR(RR%RR((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRIus N( R>R?R@R RFRRARRRI(((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRRs   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(RRKRL(RttargsR(tfunc(s0/usr/lib/python2.7/site-packages/mako/runtime.pytwrap_stackframes ((RR((Rs0/usr/lib/python2.7/site-packages/mako/runtime.pytsupports_callerscOsVtj|s!tjdn|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(RtcallableRRZR-R.tgetvalue(RtRRRR)((s0/usr/lib/python2.7/site-packages/mako/runtime.pyRs   csfd}|S(Ncsfd}|S(NcsPfd}yjd|_Wntk r9nX|||S(Ncs||S(N((Rtkw(Rtt render_fn(s0/usr/lib/python2.7/site-packages/mako/runtime.pytysi(R>R(RtRRR(tfnR(Rts0/usr/lib/python2.7/site-packages/mako/runtime.pytgos  ((RR(R(Rs0/usr/lib/python2.7/site-packages/mako/runtime.pytdecorate_renders ((RR((Rs0/usr/lib/python2.7/site-packages/mako/runtime.pyt_decorate_toplevels csfd}|S(Ncs"|fd}|S(Ncs||S(N((RR(Rttdec(s0/usr/lib/python2.7/site-packages/mako/runtime.pyRs((RR(RtR(Rs0/usr/lib/python2.7/site-packages/mako/runtime.pyRs ((RtRR((RtRs0/usr/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(RRR=t_kwargs_for_includeR(RtR}RxRRRtctx((s0/usr/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<|jds:    'A R2