Ñò -!Lc@s0dZddklZddklZlZlZlZddkZddk Z ddk Z ddk Z ddk Z ddk Z ddkZddkZddkZddkZdefd„ƒYZdefd„ƒYZd efd „ƒYZd efd „ƒYZd „Zd„Zd„Zd„ZdS(s…Provides the Template class, a facade for parsing, generating and executing template strings, as well as template runtime operations.iÿÿÿÿ(tLexer(truntimetutilt exceptionstcodegenNtTemplatecBsÎeZdZdddeddddddddddedddded„Zd„Zed„ƒZ ed„ƒZ ed„ƒZ d„Z d„Z d „Zd „Zd „Zd „Zed „ƒZRS(sa compiled templatetstrictcCsã|o%tidd|ƒ|_||_nŽ|oatidd|ƒ|_tii|ƒ\}}tii|ƒitii dƒ}||_n&dt t |ƒƒ|_|i|_||_ ||_ ||_||_tio|otidƒ‚n|d jo4tip |iodg|_qKdg|_n ||_||_||_||_|d j oGt|||ƒ\}}||_||_t|d ||||ƒnÆ|d j o©| d j o | }n}| d j oi|i}|ddjo|d }ntiitiitii| ƒtii|ƒd ƒƒ}nd }|i||ƒ}nti d ƒ‚||_!||_"|i!i#|_$||_%||_&||_'| |_(| |_)| |_*||_+d S( slConstruct a new Template instance using either literal template text, or a previously loaded template module :param text: textual template source, or None if a module is to be provided :param uri: the uri of this template, or some identifying string. defaults to the full filename given, or "memory:(hex id of this Template)" if no filename :param filename: filename of the source template, if any :param format_exceptions: catch exceptions and format them into an error display template s\Wt_t/smemory:s4Mako for Python 3 does not support disabling Unicodetstrtunicodeiis.pys"Template requires text or filenameN(,tretsubt module_idturitostpatht splitdrivetnormpathtreplacetsepthextidtinput_encodingtoutput_encodingtencoding_errorstdisable_unicodeRtpy3kRtUnsupportedErrortNonetdefault_filterstbuffer_filterstimportst preprocessort _compile_textt_codet_sourcet ModuleInfotabspathtjoint_compile_from_filetRuntimeExceptiontmoduletfilenamet render_bodyt callable_tformat_exceptionst error_handlertlookupt cache_typet cache_dirt cache_urlt cache_enabled(tselfttextR+RR.R/R0RRtmodule_directoryR1R2R3tmodule_filenameRRRRR R!R4tdriveRtcodeR*tu((s1/usr/lib/python2.6/site-packages/mako/template.pyt__init__sn% $                                cCs›|dj o8titii|ƒƒti|ƒti}tii|ƒ pti|ƒti|jo&t |t |dƒi ƒ||ƒnt i |i|t |dƒƒ}ti|i=|itijoTt |t |dƒi ƒ||ƒt i |i|t |dƒƒ}ti|i=nt||||ddƒnSt|t |dƒi ƒ|ƒ\}}d|_||_t|d|||dƒ|S(Ntrb(RRtverify_directoryRRtdirnametstattST_MTIMEtexistst_compile_module_filetopentreadtimpt load_sourceR tsystmodulest _magic_numberRt MAGIC_NUMBERR%R"R$R#(R5RR+t filemtimeR*R:((s1/usr/lib/python2.6/site-packages/mako/template.pyR(s:  ! !  cCst|iƒiS(s2return the template source code for this Template.(t_get_module_info_from_callableR-tsource(R5((s1/usr/lib/python2.6/site-packages/mako/template.pyRN¢scCst|iƒiS(s/return the module source code for this Template(RMR-R:(R5((s1/usr/lib/python2.6/site-packages/mako/template.pyR:¨scCs |iiS(N(R*t_template_cache(R5((s1/usr/lib/python2.6/site-packages/mako/template.pytcache®scOsti||i||ƒS(sòRender the output of this template as a string. if the template specifies an output encoding, the string will be encoded accordingly, else the output is raw (raw output uses cStringIO and can't handle multibyte characters). a Context object is created corresponding to the given data. Arguments that are explictly declared by this template's internal rendering method are also pulled from the given \*args, \**data members. (Rt_renderR-(R5targstdata((s1/usr/lib/python2.6/site-packages/mako/template.pytrender²s cOsti||i||dtƒS(s7render the output of this template as a unicode object.t as_unicode(RRQR-tTrue(R5RRRS((s1/usr/lib/python2.6/site-packages/mako/template.pytrender_unicode¿s  cOsFt|ddƒdjo ||_nti||i|||ŽdS(s~Render this Template with the given context. the data is written to the context's buffer. t_with_templateN(tgetattrRRXRt_render_contextR-(R5tcontextRRtkwargs((s1/usr/lib/python2.6/site-packages/mako/template.pytrender_contextÈs  cCst|id|ƒS(Ns render_%s(thasattrR*(R5tname((s1/usr/lib/python2.6/site-packages/mako/template.pythas_defÖscCst|t|id|ƒƒS(s/Return a def of this template as a DefTemplate.s render_%s(t DefTemplateRYR*(R5R_((s1/usr/lib/python2.6/site-packages/mako/template.pytget_defÙscCst|id|ƒS(Ns render_%s(RYR*(R5R_((s1/usr/lib/python2.6/site-packages/mako/template.pyt_get_def_callableÞscCs |iiS(N(R*t_modified_time(R5((s1/usr/lib/python2.6/site-packages/mako/template.pyt last_modifiedásN((t__name__t __module__t__doc__RtFalseRVR<R(tpropertyRNR:RPRTRWR]R`RbRcRe(((s1/usr/lib/python2.6/site-packages/mako/template.pyRs@ [ !    tModuleTemplatecBsDeZdZdddddddeeddddded„ZRS(sIA Template which is constructed given an existing Python module. e.g.:: t = Template("this is a template") f = file("mymodule.py", "w") f.write(t.code) f.close() import mymodule t = ModuleTemplate(mymodule) print t.render() RcCsËtidd|iƒ|_|i|_|i|_||_||_| |_ ||_ ||_ t ||||||ƒ|i i |_| |_| |_| |_| |_||_||_||_dS(Ns\WR(R R t _template_uriR Rt_source_encodingRRRRR*R+R%R,R-R.R/R0R1R2R3R4(R5R*R8ttemplatettemplate_filenamet module_sourcettemplate_sourceRRRR.R/R0R1R2R3R4((s1/usr/lib/python2.6/site-packages/mako/template.pyR<ös,             N(RfRgRhRRiRVR<(((s1/usr/lib/python2.6/site-packages/mako/template.pyRkås RacBs eZdZd„Zd„ZRS(s@a Template which represents a callable def in a parent template.cCs^||_||_|i|_|i|_|i|_|i|_|i|_|i|_dS(N(tparentR-RR*RR.R/R0(R5RrR-((s1/usr/lib/python2.6/site-packages/mako/template.pyR<"s       cCs|ii|ƒS(N(RrRb(R5R_((s1/usr/lib/python2.6/site-packages/mako/template.pyRb,s(RfRgRhR<Rb(((s1/usr/lib/python2.6/site-packages/mako/template.pyRas R%cBsAeZdZeiƒZd„Zed„ƒZed„ƒZ RS(s±Stores information about a module currently loaded into memory, provides reverse lookups of template source, module source code based on a module's identifier. cCs`||_||_||_||_||_||i|i<|_|o||i| s"xÕ:/