۶eTc@sdZddlZddlZddlZddlmZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZddlmZmZd efd YZejd ejd ZZeefZd ZdddYZddZidd6d d6dd6dddgd6idd6dd6idd 6dd6d6ed 6d!6ed"6ed#6ejd$6d%d&6dd'6d(d)6d d*6d+d,6d d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d>d>gd?6id d@6d d*6d+d,6id d@6d d*6d+d,6gdA6ddgdF6dGdHdIgdJ6dKdL6dMdN6Z dOe j!fdPYZ"dQe"fdRYZ#dSe"fdTYZ$dUe"fdVYZ%dWe"fdXYZ&dYe"fdZYZ'd[e"fd\YZ(d]e"fd^YZ)d_e"fd`YZ*dae"fdbYZ+dce"fddYZ,dee"fdfYZ-dge"fdhYZ.die"fdjYZ/dke"fdlYZ0dme"fdnYZ1doe"fdpYZ2dqe"fdrYZ3dse"fdtYZ4due"fdvYZ5dwe"fdxYZ6dye"fdzYZ7edysv[7nd{e"fd|YZ8d}e"fd~YZ9de"fdYZ:de"fdYZ;de"fdYZ<edkr[<nde"fdYZ=edkr!e=`>nde"fdYZ?de"fdYZ@de"fdYZAde"fdYZBedkr[Bnde"fdYZCde"fdYZDde"fdYZEde"fdYZFde"fdYZGde"fdYZHde"fdYZIde"fdYZJde"fdYZKde"fdYZLde"fdYZMde"fdYZNde"fdYZOde"fdYZPde"fdYZQde"fdYZRde"fdYZSejTjUdr[R[Snde"fdYZVde"fdYZWde"fdYZXde"fdYZYde"fdYZZde"fdYZEde"fdYZ[de"fdYZ\de"fdYZ]de"fdYZ^de"fdYZ_de"fdYZ`de"fdYZade"fdYZbe"jcruedkruiedd6Zen ied6ZedZfegdkrefe jhndS(sW Syntax and Output tests. TODO - #finally - #filter - #errorCatcher - #echo - #silent iN(tdeepcopy(tNotFound(t C_VERSION(tTemplate(t ParseError(tCompilertDEFAULT_COMPILER_SETTINGSt UnspecifiedcBseZRS((t__name__t __module__(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR"siicCs|S(N((tfunc((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt testdecorator(st DummyClasscBsVeZeZdZddZddZdddZdd Zd d Z RS( cCsdS(Ntobject((tself((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt__str__-starffcCs t|S(N(tstr(Rtarg((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytmeth0stdoocCs|S(N((RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytmeth13sta1ta2cCst|t|S(N(R(Rtarg1targ2((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytmeth26ss110%cCs t|S(N(R(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytmethWithPercentSignDefaultArg9sicCst|_||_dS(N(tTruet_calledt_callArg(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytcallIt<s ( RR tFalseRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR +s    tScoobycCs|S(N((R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt dummyFuncAstblargtaStrtanIntg?taFloattitem0titem1titem2taListtonettwot nestedItem1t nestedItem2t nestedDictt nestedFunctaDicttaFunctanObjtaMeths $aStr $anInttaStrToBeIncludedtnonett emptyStringtnumOneitnumTwotzeroiIt tenDigitss abc <=> &t webSafeTests# strippable whitespace tstrip1s" strippable whitespace tstrip2s( strippable whitespace 1 2 3 tstrip3s$numOne $numTwotblockToBeParseds$numOne $numTwo $aSetVart includeBlock2s parseTest.txttincludeFileNamecCs|S(N((tx((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytcst listOfLambdastindextlisttjohntdoetjanetsmithtnameListtatbtct letterListcCsd|S(Ns Translated: ((RD((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyREjst_u aoeu12345ሴt unicodeDatat OutputTestcBszeZdZeZdZeZdZ e gZ eZ dZ dZddedZdZdZdZdZRS( s Template output mismatch: Input Template = %(template)s%(end)s Expected Output = %(expected)s%(end)s Actual Output = %(actual)s%(end)sicCs|jS(N(t _searchList(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt searchListsc CsC|jrW|tkr!|j}n|rW|jd|j}|jd|j}qWn||_|jr|jpui}tjd|d|j dt |}|j }|j p|j } |d| |_} n4t|d|j d|j |_} | j }|jdkr!|GHnz| j} Wd| jXdS(Ns tsourcetcompilerSettingstkeepRefToGeneratedCodeRVi(t_EOLreplacementRt convertEOLstreplacet_inputt_useNewStyleCompilationt_extraCompileKwArgsRtcompilet_getCompilerSettingsRt_CHEETAH_generatedModuleCodeRVRUttemplatetDEBUGLEVtrespondtshutdown( RtinputtexpectedOutputt inputEncodingtoutputEncodingR[t extraKwArgst templateClasst moduleCodeRVt templateObjtoutput((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytverifys8            cCsiS(N((R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRascCs|jro|jro|j}d}|ji|jj||d6|j||d6|j||d6dd6S|ji|jd6|d6|d6dd6SdS(Ns*EOL*Rctexpectedtactuals(end)tend(t_debugEOLReplacementRZtreportR]R\(RRoRhtEOLrepltmarker((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt_outputMismatchReports  cCs t|dr|jjSdS(NRc(thasattrRctgeneratedClassCode(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt genClassCodescCs t|dr|jjSdS(NRc(RyRctgeneratedModuleCode(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt genModuleCodesN(RR RuRR[tNoneRZR RtRdtdefaultTestNameSpaceRUR^R_RVRRpRaRxR{R}(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRTrs     $   t EmptyTemplatecBseZeZdZRS(cCstjddty|jddWntk r:nX|jdy|jddWntk ronX|jd|jdd|jddd S( s an empty string for the templateterrors,You supplied an empty string for the source!R7s'Should warn about empty source strings.s#implements foos7This should barf about respond() not being implemented.s#implements responds#implements respond(foo=1234)N(twarningstfilterwarningst UserWarningRptfailtNotImplementedError(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest1s     (RR R R[R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRst BackslashescBsheZeZdZdZdZdZdZdZ dZ dZ dZ d Z RS( cCs5tdd}|jdd|j|jdS(Nsbackslashes.txttws(\ #LogFormat "%h %l %u %t \"%r\" %>s %b"s (topentwritetflushtclose(Rtfp((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pytsetUps cCs&tjjdr"tjdndS(Nsbackslashes.txt(tostpathtexiststremove(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttearDownscCs|jdddS(s a single \ using rawstringss\ N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s. a single \ using rawstrings and lots of liness\ s Ns \ s \ (Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest2s cCs|jdddS(s$ a single \ without using rawstringss\ \ N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest3s cCs|jdddS(s% single line from an apache conf files&#LogFormat "%h %l %u %t \"%r\" %>s %b"N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest4s cCs|jdddddS(sS single line from an apache conf file with many NEWLINES The NEWLINES are used to make sure that MethodCompiler.commitStrConst() is handling long and short strings in the same fashion. It uses triple-quotes for strings with lots of \n in them and repr(theStr) for shorter strings with only a few newlines.s&#LogFormat "%h %l %u %t \"%r\" %>s %b"s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest5 s cCs|jddddS(s, test backslash handling in an included files#include "backslashes.txt"s(\ #LogFormat "%h %l %u %t \"%r\" %>s %b"s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest6s cCs|jdddS(s7 a single \ without using rawstrings plus many NEWLINESs\ \ s Ns \ \ s \ \ (Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest7s cCs|jdddddS(sT single line from an apache conf file with single quotes and many NEWLINES s&#LogFormat '%h %l %u %t \"%r\" %>s %b's N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest8"s (RR R R[RRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs        t NonTokenscBsGeZdZdZdZdZdZdZdZRS(cCs|jdddS(s!dollar signs not in Cheetah $varss$ $$ $5 $. $ testN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR*s cCs|jdddS(shash not in #directivess# \# #5 s# # #5 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR/s cCs|jdddS(sescapted commentss \##escaped comment s ##escaped comment N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR4s cCs|jdddS(sescapted multi-line commentss \#*escaped comment *# s #*escaped comment *# N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR9s cCs|jdddS(s 1 dollar signt$N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR>s cCs|jdddS(s1 dollar sign followed by hashs $# N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyt_X_test6Bs cCs9tdr%|jdtddn|jdddS(s)1 dollar sign followed by EOL Slurp Tokent EOLSlurpTokens $%s s $s $# N(RRp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRGs    ( RR RRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR)s      tComments_SingleLinecBskeZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( cCs|jdddS(s## followed by WSs## R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRQs cCs|jdddS(s## followed by NEWLINEs## R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRVs cCs|jdddS(s ## followed by text then NEWLINEs## oeuao aoe uaoe R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR[s cCs|jdddS(s## gobbles leading WSs ## oeuao aoe uaoe R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR_s cCs|jdddS(s.## followed by text then NEWLINE, + leading WSs ## oeuao aoe uaoe R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRds cCs|jdddS(s## followed by EOFs##R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRis cCs|jdddS(s"## followed by EOF with leading WSs ##R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRns cCs|jdddS(s@## gobble line with text on previous and following linessline1 ## aoeu 1234 line2s line1 line2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRss cCs|jdddS(sF## don't gobble line with text on previous and following linessline1 12 ## aoeu 1234 line2sline1 12 line2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest9ys cCs|jdddS(s$## containing $placeholders s ##$a$b $c($d)R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest10s cCs|jdddS(s%## containing #for directive s##for $i in range(15)R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest11s ( RR RRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRPs          tComments_MultiLine_NoGobblecBs;eZdZdZdZdZdZdZRS(s Multiline comments used to not gobble whitespace. They do now, but this can be turned off with a compilerSetting cCs itd6S(Nt'gobbleWhitespaceAroundMultiLineComments(R (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRascCs|jdddS(s9#* *# followed by WS Shouldn't gobble WS s#* blarg *# s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sF#* *# preceded and followed by WS Shouldn't gobble WS s #* blarg *# s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sG#* *# followed by WS, with NEWLINE Shouldn't gobble WS s#* blarg *# s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sT#* *# preceded and followed by WS, with NEWLINE Shouldn't gobble WS s #* blarg *# s N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR t__doc__RaRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs     tComments_MultiLinecBsqeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z RS( s; Note: Multiline comments don't gobble whitespace! cCs|jdddS(s6#* *# followed by WS Should gobble WS s#* blarg *# R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sC#* *# preceded and followed by WS Should gobble WS s #* blarg *# R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sG#* *# followed by WS, with NEWLINE Shouldn't gobble WS s#* blarg *# R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sT#* *# preceded and followed by WS, with NEWLINE Shouldn't gobble WS s #* blarg *# R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s"#* *# containing nothing s#**#R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s'#* *# containing only NEWLINES s #* *# R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s'#* *# containing $placeholders s#* $var $var(1234*$c) *#R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s(#* *# containing #for directive s#* #for $i in range(15) *#R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s5 text around #* *# containing #for directive s+foo foo bar #* #for $i in range(15) *# foo sfoo foo bar foo N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sm text around #* *# containing #for directive and trailing whitespace which should be gobbled s.foo foo bar #* #for $i in range(15) *# testsfoo foo bar testN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sx text around #* *# containing #for directive and newlines: trailing whitespace which should be gobbled. s2foo foo bar #* #for $i in range(15) *# testsfoo foo bar testN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs ( RR RRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs          t PlaceholderscBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZRS(cCs|jdddS(s 1 placeholders$aStrR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s2 placeholderss $aStr $anIntsblarg 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s2 placeholders, back-to-backs $aStr$anInttblarg1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s1 placeholder enclosed in ()s$(aStr)R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jdddS(s1 placeholder enclosed in {}s${aStr}R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s1 placeholder enclosed in []s$[aStr]R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(sg1 placeholder enclosed in () + WS Test to make sure that $(.. matches s $( aStr )R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s!1 placeholder enclosed in {} + WSs ${ aStr }R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s!1 placeholder enclosed in [] + WSs $[ aStr ]R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR"scCs|jdddS(sr1 placeholder enclosed in () + WS + * cache Test to make sure that $*(.. matches s $*( aStr )R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR&scCs|jdddS(s*1 placeholder enclosed in {} + WS + *caches $*{ aStr }R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR-scCs|jdddS(s*1 placeholder enclosed in [] + WS + *caches $*[ aStr ]R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest121scCs|jdddS(s01 placeholder enclosed in {} + WS + **caches$*5*{ aStr }R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest135scCs|jdddS(s01 placeholder enclosed in [] + WS + **caches$*5*[ aStr ]R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest149scCs|jdddS(s21 placeholder enclosed in {} + WS + **caches$*0.5d*{ aStr }R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest15=scCs|jdddS(s21 placeholder enclosed in [] + WS + **caches$*.5*[ aStr ]R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest16AscCs|jdddS(s1 placeholder + **caches$*5*aStrR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest17EscCs|jdddS(s1 placeholder **caches $*0.5h*aStrR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest18IscCs|jdddS(s?1 placeholder surrounded by single quotes and multiple newliness' '$aStr' 's' 'blarg' 'N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest19Ms cCsI|jddy|jddWntk r7nX|jddS(ssilent mode $!placeholders s0$!aStr$!nonExistant$!*nonExistant$!{nonExistant}R#s$!aStr$nonExistantsshould raise NotFound exceptionN(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest20Rs   cCsvd}|j}tjddt}|jd}|jd}|jd}td krr|jd}ndS( s,Make sure that $*caching is actually workingsYou Me Them Everyones#for name in $names: $name t baseclasss#for name in $names: $*name s#for name in $names: $*1*name s #for name in $names: $*1*(name) iN(ii(tsplitRR`tdicttsubclasst versionTuple(RtnamesStrtnamesttmpl((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest21^s  (RR RRRRRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs*                    tPlaceholders_ValscBs_eZeZdZdZdZdZdZdZ dZ dZ dZ RS( cCs|jdddS(tstrings$aStrR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRuscCs|jdddS(sstring - with whitespaces $aStr s blarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRyscCs|jdddS(sempty string - with whitespaces $emptyStringR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR}scCs|jdddS(tints$anIntt1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(tfloats$aFloats1.5N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(RHs$aLists['item0', 'item1', 'item2']N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s@None The default output filter is ReplaceNone. s$noneR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs*|jddttttfdS(sTrue, False s $True $Falses%s %sN(RptreprRR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s $_ s $_('foo')sTranslated: fooN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs( RR R R[RRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRss        tPlaceholderStringscBsGeZdZdZdZdZdZdZdZRS(cCs|jdddS(s&some c'text $placeholder text' stringss$str(c'$aStr')R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringss$str(c'$aStr.upper')tBLARGN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringss-$str(c'$(aStr.upper.replace(c"A$str()",""))')tBLRGN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringss#echo $str(c'$(aStr.upper)')RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringss(#if 1 then $str(c'$(aStr.upper)') else 0RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringss1#if 1 $str(c'$(aStr.upper)')#slurp #else 0#end ifRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&some c'text $placeholder text' stringssK#def foo(arg=c'$("BLARG")') $arg#slurp #end def $foo()$foo(c'$anInt')#slurptBLARG1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs ( RR RRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs      tUnicodeStringscBseZdZdZRS(cCs|jdtddS(s$unicode data in placeholder u $unicodeDataRSN(RpR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(sunicode data in body u aoeu12345ሴN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs tEncodingDirectivecBs>eZdZdZdZdZdZdZRS(cCs|jdddS(sbasic #encoding s#encoding utf-8 1234t1234N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sbasic #encoding s#encoding ascii 1234RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddddS(sbasic #encoding s#encoding utf-8 ሴuሴRjtutf8N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sbasic #encoding s#encoding latin-1 ሴuሴN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sbasic #encoding s#encoding latin-1 AndruAndr‚N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddddS(s"Using #encoding on the second lines2### Comments on the first line #encoding utf-8 ሴuሴRjRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs      tUnicodeDirectivecBseZdZRS(cCs|jdd|jdd|jdd|jdd|jdd|jdd|jd d|jd dd S( sbasic #unicode s#unicode utf-8 1234u1234s#unicode ascii 1234s#unicode latin-1 1234s#unicode latin-1 1234u1234üs#unicode: latin-1 1234s# unicode : latin-1 1234u#unicode latin-1 1234üs#encoding latin-1 1234N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs         (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRstPlaceholders_EsccBs;eZeZdZdZdZdZdZRS(cCs|jdddS(s1 escaped placeholders\$vars$varN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s2 escaped placeholderss \$var \$_s$var $_N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s%2 escaped placeholders - back to backs\$var\$_s$var$_N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s2 escaped placeholders - nesteds \$var(\$_)s$var($_)N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s,2 escaped placeholders - nested and encloseds \$(var(\$_)s $(var($_)N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs ( RR R R[RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs     tPlaceholders_CallscBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZRS(cCs|jdddS(sfunc placeholder - no ()s$aFuncR!N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR%s cCs|jdddS(sfunc placeholder - with ()s$aFunc()R!N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR*s cCs|jdddtdS(sfunc placeholder - with (\n\n)s $aFunc( )R!R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR/s cCs|jdddtdS(s0func placeholder - with (\n\n) and $() enclosures $(aFunc( ))R!R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR4s cCs|jdddtdS(s0func placeholder - with (\n\n) and ${} enclosures ${aFunc( )}R!R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR9s cCs|jdddS(sfunc placeholder - with (int)s $aFunc(1234)RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR>s cCs|jdddtdS(s!func placeholder - with (\nint\n)s$aFunc( 1234 )RR[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRCs cCs|jdddS(s func placeholder - with (string)s$aFunc('aoeu')taoeuN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRGs cCs|jdddS(s&func placeholder - with ('''string''')s$aFunc('''aoeu''')RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRLs cCs|jdddtdS(s*func placeholder - with ('''\nstring\n''')s$aFunc(''' aoeu ''')s aoeu R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRPs cCs|jdddtdS(s+func placeholder - with ('''\nstring'\n''')s$aFunc(''' aoeu' ''')s aoeu' R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRUs cCs|jdddtdS(s*func placeholder - with ("""\nstring\n""")s$aFunc(""" aoeu """)s aoeu R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRZs cCs|jdddS(s$func placeholder - with (string*int)s$aFunc('aoeu'*2)taoeuaoeuN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR_s cCs|jdddS(s!func placeholder - with (int*int)s $aFunc(2*2)t4N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRds cCs|jdddS(s#func placeholder - with (int*float)s $aFunc(2*2.0)s4.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRis cCs|jdddtdS(s'func placeholder - with (int\n*\nfloat)s$aFunc(2 * 2.0)s4.0R[N(RpR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRns cCs|jdddS(s$func placeholder - with ($arg=float)s$aFunc($arg=4.0)s4.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRss cCs|jdddS(s#func placeholder - with (arg=float)s$aFunc(arg=4.0)s4.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRxs cCs|jdddS(s%deeply nested argstring, no enclosures#$aFunc($arg=$aMeth($arg=$aFunc(1)))RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR}s cCs|jdddS(s/deeply nested argstring, no enclosure + with WSs.$aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) )RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s/deeply nested argstring, () enclosure + with WSs1$(aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) ) )RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s/deeply nested argstring, {} enclosure + with WSs1${aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) ) }RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest22s cCs|jdddS(s/deeply nested argstring, [] enclosure + with WSs1$[aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) ) ]RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest23s cCs|jdddS(s.deeply nested argstring, () enclosure + *caches2$*(aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) ) )RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest24s cCs|jdddS(s1deeply nested argstring, () enclosure + *15*caches5$*15*(aFunc( $arg = $aMeth( $arg = $aFunc( 1 ) ) ) )RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest25s cCs|jdddS(s(a function call with the Python None kw.s $aFunc(None)R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest26s (RR RRRRRRRRRRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR$s4                         t NameMappercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZRS(cCs|jdddS(t autocallings$aFunc! $aFunc().sScooby! Scooby.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(snested autocallings$aFunc($aFunc).sScooby.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(slist subscriptions $aList[0]R'N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s list slicings $aList[:2]s['item0', 'item1']N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s%list slicing and subcription combineds $aList[:2][0]R'N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s$dictionary access - NameMapper styles $aDict.oneR(N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s dictionary access - Python styles $aDict['one']R(N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s8dictionary access combined with autocalled string methods$aDict.one.uppertITEM1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s-dictionary access combined with string methods$aDict.one.upper()RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s+nested dictionary access - NameMapper styles$aDict.nestedDict.twoR.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s'nested dictionary access - Python styles$aDict['nestedDict']['two']R.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s,nested dictionary access - alternating styles$aDict['nestedDict'].twoR.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s9nested dictionary access using method - alternating styles$aDict.get('nestedDict').twoR.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s@nested dictionary access - NameMapper style - followed by methods$aDict.nestedDict.two.uppert NESTEDITEM2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sAnested dictionary access - alternating style - followed by methods$aDict['nestedDict'].two.upperRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sLnested dictionary access - NameMapper style - followed by method, then slices$aDict.nestedDict.two.upper[:4]tNESTN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s>nested dictionary access - Python style using a soft-coded keys%$aDict[$anObj.meth('nestedDict')].twoR.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sobject method accesss $anObj.meth1RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s/object method access, followed by complex slices-$anObj.meth1[0: ((4/4*2)*2)/$anObj.meth1(2) ]tdoN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(ssobject method access, followed by a very complex slice If it can pass this one, it's safe to say it works!!s4$( anObj.meth1[0: ( (4/4*2)*2)/$anObj.meth1(2) ] )RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sobject method access with % in the default arg for the meth. This tests a bug that Jeff Johnson found and submitted a patch to SF for.s$$anObj.methWithPercentSignDefaultArgs110%N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RRRRRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs*                    tCacheDirectivecBs>eZdZdZdZdZdZdZRS(cCs|jdddS(ssimple #cache s #cache:$anIntRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(ssimple #cache + WSs #cache $anInt#end cacheRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR$s cCs|jdddS(ssimple #cache ... #end caches6#cache id='cache1', timer=150m $anInt #end cache $aStrs1 blargN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR)scCs|jddddS(s2 #cache ... #end cache blockss#slurp #def foo #cache ID='cache1', timer=150m $anInt #end cache #cache id='cache2', timer=15s #for $i in range(5) $i#slurp #end for #end cache $aStr#slurp #end def $foo$foo$foo$foo$foos 1 01234blargiN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR1s cCs|jddddS(snested #cache blockss#slurp #def foo #cache ID='cache1', timer=150m $anInt #cache id='cache2', timer=15s #for $i in range(5) $i#slurp #end for $*(6)#slurp #end cache #end cache $aStr#slurp #end def $foo$foo$foo$foo$foos 1 012346blargiN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRCs cCs$|jdd|jdddS(s-Make sure that partial directives don't matchs #cache_foos#cachedN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRUs  (RR RRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs      t CallDirectivecBsYeZdZdZdZdZdZdZdZdZ dZ RS( cCs4|jdd|jdd|jdddS(s simple #call s#call int $anInt#end callRs#call int: $anInts#call int: 10 $aStrs10 blargN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR^s    cCs|jdddS(ssimple #call + WSs#call int $anInt #end callRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRhs cCs|jdddS(sa longer #callsT#def meth(arg) $arg.upper()#slurp #end def #call $meth $(1234+1) foo#slurp #end calls1235 FOON(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRmscCs|jdddS(s#call with keyword #argss#def meth(arg1, arg2) $arg1.upper() - $arg2.lower()#slurp #end def #call self.meth #arg arg1 $(1234+1) foo#slurp #arg arg2 UPPER#slurp #end calls1235 FOO - upperN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRxs cCs|jdddS(s%#call with single-line keyword #args s#def meth(arg1, arg2) $arg1.upper() - $arg2.lower()#slurp #end def #call self.meth #arg arg1:$(1234+1) foo#slurp #arg arg2:UPPER#slurp #end calls1235 FOO - upperN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(sM#call with python kwargs and cheetah output for the 1s positional args}#def meth(arg1, arg2) $arg1.upper() - $arg2.lower()#slurp #end def #call self.meth arg2="UPPER" $(1234+1) foo#slurp #end calls1235 FOO - upperN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s"#call with python kwargs and #argss#def meth(arg1, arg2, arg3) $arg1.upper() - $arg2.lower() - $arg3#slurp #end def #call self.meth arg2="UPPER", arg3=999 #arg arg1:$(1234+1) foo#slurp #end calls1235 FOO - upper - 999N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(sh#call with python kwargs and #args, and using a function to get the function that will be calleds#def meth(arg1, arg2, arg3) $arg1.upper() - $arg2.lower() - $arg3#slurp #end def #call getattr(self, "meth") arg2="UPPER", arg3=999 #arg arg1:$(1234+1) foo#slurp #end calls1235 FOO - upper - 999N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(snested #call directivess#def meth(arg1) $arg1#slurp #end def #def meth2(x,y) $x$y#slurp #end def ## #call self.meth 1#slurp #call self.meth 2#slurp #call self.meth 3#slurp #end call 3 #set two = 2 #call self.meth2 y=c"$(10/$two)" #arg x 4#slurp #end call 4 #end call 2 #end call 1t12345N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs( RR RRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR\s   t I18nDirectivecBseZdZRS(cCs4|jdd|jdd|jdddS(s simple #call s#i18n $anInt#end i18nRs #i18n: $anInts#i18n: 10 $aStrs10 blargN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRstCaptureDirectivecBseZdZdZRS(cCs|jdddS(ssimple #captures;#capture cap1 $(1234+1) foo#slurp #end capture $cap1#slurp s1235 fooN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(sslightly more complex #capturesv#def meth(arg) $arg.upper()#slurp #end def #capture cap1 $(1234+1) $anInt $meth("foo")#slurp #end capture $cap1#slurp s 1235 1 FOON(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs tSlurpDirectivecBs5eZdZdZdZdZdZRS(cCs|jdddS(s#slurp with 1 \n s#slurp R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s:#slurp with 1 \n, leading whitespace Should gobbles #slurp R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s:#slurp with 1 \n, leading content Shouldn't gobbles 1234 #slurp s 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s@#slurp with WS then \n, leading content Shouldn't gobbles 1234 #slurp s 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(sQ#slurp with garbage chars then \n, leading content Should eat the garbages 1234 #slurp garbage s 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs     RcBs?eZedZdZdZdZdZdZRS(RcCs|jd|jddS(s#slurp with 1 \n s%s R7N(Rpt_EOLSlurpToken(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jd|jddS(s:#slurp with 1 \n, leading whitespace Should gobbles %s R7N(RpR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jd|jddS(s:#slurp with 1 \n, leading content Shouldn't gobbles 1234 %s s 1234 N(RpR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR%scCs|jd|jddS(s@#slurp with WS then \n, leading content Shouldn't gobbles 1234 %s s 1234 N(RpR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR+scCs"|jd|jd|jdS(sU#slurp with garbage chars then \n, leading content Should NOT eat the garbages 1234 %s garbage N(RpR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR1s( RR RRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs      t RawDirectivecBs>eZdZdZdZdZdZdZRS(cCs|jdddS(s #raw till EOFs#raw $aFunc(). s $aFunc(). N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR;s cCs|jdddS(s#raw till #end raws#raw $aFunc(). #end raw $anInts $aFunc(). 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR@s cCs|jdddS(s#raw till #end raw gobble WSs' #raw $aFunc(). #end raw $anInts $aFunc(). 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyREs cCs|jdddS(sL#raw till #end raw using explicit directive closure Shouldn't gobbles) #raw # $aFunc(). #end raw # $anInts $aFunc(). 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRJs cCs$|jdd|jdddS(ssingle-line short form #raw: s#raw: $aFunc(). s $aFunc(). s#raw: $aFunc(). $anInts $aFunc(). 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRPs  cCs|jdddS(s# Escape characters in a #raw block sv#raw: This escape should be preserved: \$unexpanded So should this one: \#blah The string "\012" should not disappear.spThis escape should be preserved: \$unexpanded So should this one: \#blah The string "\012" should not disappear.N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRXs (RR RRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR:s      tBreakpointDirectivecBs#eZdZdZdZRS(cCs|jdddS(s(#breakpoint part way through source codes$aFunc(2). #breakpoint $anInts2. N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR_s cCs|jdddS(s#breakpoint at BOFs#breakpoint $anIntR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRds cCs|jdddS(s#breakpoint at EOFs$anInt #breakpoints1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRis (RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR^s  t StopDirectivecBs5eZdZdZdZdZdZRS(cCs|jdddS(s"#stop part way through source codes$aFunc(2). #stop $anInts2. N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRps cCs|jdddS(s #stop at BOFs #stop $anIntR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRus cCs|jdddS(s #stop at EOFs $anInt #stops1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRzs cCs|jdddS(s#stop in pos test blocks4$anInt #if 1 inside the if block #stop #end if blargs1 inside the if block N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s#stop in neg test blocks4$anInt #if 0 inside the if block #stop #end if blargs1 blargN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRos     tReturnDirectivecBs#eZdZdZdZRS(cCs|jdddS(s#return'ing an int s[1 $str($test-6) 3 #def test #if 1 #return (3 *2) + 2 #else aoeuoaeu #end if #end def s1 2 3 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#return'ing an string sQ1 $str($test[1]) 3 #def test #if 1 #return '123' #else aoeuoaeu #end if #end def s1 2 3 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(sD#return'ing an string AND streaming other output via the transactionsb1 $str($test(trans=trans)[1]) 3 #def test 1.5 #if 1 #return '123' #else aoeuoaeu #end if #end def s 1 1.5 2 3 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  tYieldDirectivecBseZeZdZRS(c Cssd}d}d}xZ|||fD]I}tj|dt}|j}g|D]}t|^qS}q"WdS(ssimple #yield s%#for i in range(10) #yield i #end fors,#for i in range(10) $i#slurp #yield #end fors[#def iterator #for i in range(10) #yield i #end for #end def #for i in $iterator $i#end forRYN(RR`RReR( Rtsrc1tsrc2tsrc3tsrctklasstitertiRo((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR R R[R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRsit ForDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(cCsD|jdd|jdd|jdd|jdddS(s#for loop with one local vars#for $i in range(5) $i #end fors 0 1 2 3 4 s #for $i in range(5): $i #end fors*#for $i in range(5): ##comment $i #end fors)#for $i in range(5) ##comment $i #end forN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    cCs|jdddS(s#for loop with WS in loops #for $i in range(5) $i #end fors0 1 2 3 4 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#for loop gobble WSs, #for $i in range(5) $i #end for s0 1 2 3 4 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#for loop over lists+#for $i, $j in [(0,1),(2,3)] $i,$j #end fors0,1 2,3 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s #for loop over list, with #slurps1#for $i, $j in [(0,1),(2,3)] $i,$j#slurp #end fors0,12,3N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s #for loop with explicit closuress#for $i in range(5)#$i#end for#t01234N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s'#for loop with explicit closures and WSs# #for $i in range(5)#$i#end for# s 01234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#for loop using another $vars+ #for $i in range($aFunc(5))#$i#end for# s 01234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(stest methods in for loopss3#for $func in $listOfLambdas $func($anInt) #end fors1 1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs$|jdd|jdddS(s/#for loop over list, using methods of the itemssA#for i, j in [('aa','bb'),('cc','dd')] $i.upper,$j.upper #end fors AA,BB CC,DD sC#for $i, $j in [('aa','bb'),('cc','dd')] $i.upper,$j.upper #end forN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  cCs$|jdd|jdddS(s4#for loop over list, using ($i,$j) style target listsC#for (i, j) in [('aa','bb'),('cc','dd')] $i.upper,$j.upper #end fors AA,BB CC,DD sE#for ($i, $j) in [('aa','bb'),('cc','dd')] $i.upper,$j.upper #end forN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR"s  cCs$|jdd|jdddS(s5#for loop over list, using i, (j,k) style target listsQ#for i, (j, k) in enumerate([('aa','bb'),('cc','dd')]) $j.upper,$k.upper #end fors AA,BB CC,DD sT#for $i, ($j, $k) in enumerate([('aa','bb'),('cc','dd')]) $j.upper,$k.upper #end forN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR)s  cCs|jdddS(ssingle line #fors#for $i in range($aFunc(5)): $iRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR0s cCs|jdddS(s+single line #for with 1 extra leading spaces #for $i in range($aFunc(5)): $is 0 1 2 3 4N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR5s cCs|jddddS(s2 times single line #fors&#for $i in range($aFunc(5)): $i#slurp iRNt 0123401234(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR:s cCs|jdddS(sfalse single line #for s!#for $i in range(5): $i #end fors 0 1 2 3 4 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR?s (RR RRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs                tRepeatDirectivecBs>eZdZdZdZdZdZdZRS(cCsD|jdd|jdd|jdd|jdddS(s basic #repeats#repeat 3 1 #end repeats1 1 1 s#repeat 3: 1 #end repeats!#repeat 3 ##comment 1 #end repeats"#repeat 3: ##comment 1 #end repeatN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRIs    cCs|jdddS(s#repeat with numeric expressions#repeat 3*3/3 1 #end repeats1 1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRVs cCs|jdddS(s#repeat with placeholders#repeat $numTwo 1 #end repeats1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR[s cCs|jdddS(s#repeat with placeholder * nums#repeat $numTwo*1 1 #end repeats1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR`s cCs|jdddS(s#repeat with placeholder and WSs) #repeat $numTwo 1 #end repeat s1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRes cCs8|jdd|jddd |jdddS( ssingle-line #repeats#repeat $numTwo: 1t11s#repeat $numTwo: 1 is1 1 s#repeat 3: 1 #end repeats1 1 1 Ns1 1 1 1 (Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRjs    (RR RRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRGs     t AttrDirectivecBs5eZdZdZdZdZdZRS(cCs|jdddS(s#attr with ints#attr $test = 1234 $testRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRxs cCs|jdddS(s#attr with strings#attr $test = 'blarg' $testR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR}s cCs|jdddS(s#attr with expressions%#attr $test = 'blarg'.upper()*2 $testt BLARGBLARGN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s,#attr with string + WS Should gobbles# #attr $test = 'blarg' $testR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s>#attr with string + WS + leading text Shouldn't gobbles% -- #attr $test = 'blarg' $tests -- blargN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRvs     t DefDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZRS(cCs4|jdd|jdd|jdddS(s#def without argstrings%#def testMeth 1234 #end def $testMeths1234 s0#def testMeth ## comment 1234 #end def $testMeths1#def testMeth: ## comment 1234 #end def $testMethN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    cCs|jdddS(s!#def without argstring, gobble WSs1 #def testMeth 1234 #end def $testMeths1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#def with argstring, gobble WSs7 #def testMeth($a=999) 1234-$a #end def $testMeths 1234-999 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s3#def with argstring, gobble WS, string used in calls> #def testMeth($a=999) 1234-$a #end def $testMeth('ABC')s 1234-ABC N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s1#def with argstring, gobble WS, list used in calls@ #def testMeth($a=999) 1234-$a #end def $testMeth([1,2,3])s1234-[1, 2, 3] N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s.#def with 2 args, gobble WS, list used in callsL #def testMeth($a, $b='default') 1234-$a$b #end def $testMeth([1,2,3])s1234-[1, 2, 3]default N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#def with *args, gobble WSs: #def testMeth($*args) 1234-$args #end def $testMeths1234-() N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#def with **KWs, gobble WSs9 #def testMeth($**KWs) 1234-$KWs #end def $testMeths1234-{} N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s"#def with *args + **KWs, gobble WSsG #def testMeth($*args, $**KWs) 1234-$args-$KWs #end def $testMeths 1234-()-{} N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s"#def with *args + **KWs, gobble WSsS #def testMeth($*args, $**KWs) 1234-$args-$KWs.a #end def $testMeth(1,2, a=1)s1234-(1, 2)-1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(ssingle line #def with extra WSs%#def testMeth: aoeuaoeu - $testMeth -s - aoeuaoeu -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s7single line #def with extra WS and nested $placeholderss0#def testMeth: $anInt $aFunc(1234) - $testMeth -s - 1 1234 -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s&single line #def escaped $placeholderss-#def testMeth: \$aFunc(\$anInt) - $testMeth -s- $aFunc($anInt) -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s(single line #def 1 escaped $placeholderss,#def testMeth: \$aFunc($anInt) - $testMeth -s - $aFunc(1) -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s2single line #def 1 escaped $placeholders + more WSs0#def testMeth : \$aFunc($anInt) - $testMeth -s - $aFunc(1) -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s#multiline #def with $ on methodNames&#def $testMeth 1234 #end def $testMeths1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s%single line #def with $ on methodNames#def $testMeth:1234 $testMethRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s!single line #def with an arguments(#def $testMeth($arg=1234):$arg $testMethRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs$|jdddddddS(s/#def that extends over two lines with argumentss#def $testMeth($arg=1234, s $arg2=5678) s $arg $arg2 s #end def s $testMeths 1234 5678 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RRRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs&                 tDecoratorDirectivecBseZdZdZRS(cCs|jdd|jdd|jdd|jdddd|jddddy|jdd ddWntk rnX|jd d S( ssingle line #def with decorators#@ blahs #@23 blahs#@@TR: comments9#from Cheetah.Tests.SyntaxAndOutput import testdecorator s#@testdecorators #def $testMeth():1234 $testMethRs #block $testMeth():1234s#@testdecorator sdfsshould raise a ParseErrorN(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs      cCs$|jdddddddS(s#def with multiple decoratorss9#from Cheetah.Tests.SyntaxAndOutput import testdecorator s#@testdecorator s#def testMeth s1234 #end def $testMeths1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR&s(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs itBlockDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZRS(cCs$|jdd|jdddS(s#block without argstrings #block testBlock 1234 #end blocks1234 s*#block testBlock ##comment 1234 #end blockN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR6s  cCs|jdddS(s##block without argstring, gobble WSs) #block testBlock 1234 #end block s1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR>s cCs|jdddS(s#block with argstring, gobble WS Because blocks can be reused in multiple parts of the template arguments (!!with defaults!!) can be given.s4 #block testBlock($a=999) 1234-$a #end block s 1234-999 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRCs cCs|jdddS(s#block with 2 args, gobble WSs> #block testBlock($a=999, $b=444) 1234-$a$b #end block s 1234-999444 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRLs cCs|jdddS(s#block with 2 nested blocks Blocks can be nested to any depth and the name of the block is optional for the #end block part: #end block OR #end block [name] s#block testBlock this is a test block #block outerNest outer #block innerNest inner #end block innerNest #end block outerNest --- #end block testBlock s%this is a test block outer inner --- N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRRs cCs|jdddS(ssingle line #block s!#block testMeth: This is my blocksThis is my blockN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRfscCs|jdddS(ssingle line #block with WSs!#block testMeth: This is my blocksThis is my blockN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRlscCs|jdddS(s*single line #block 1 escaped $placeholderss #block testMeth: \$aFunc($anInt)s $aFunc(1)N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRrscCs|jdddS(s/single line #block 1 escaped $placeholders + WSs"#block testMeth: \$aFunc( $anInt )s $aFunc( 1 )N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRxscCs|jdddS(s4single line #block 1 escaped $placeholders + more WSs$#block testMeth : \$aFunc( $anInt )s $aFunc( 1 )N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR~scCs|jdddS(smultiline #block $ on argstrings!#block $testBlock 1234 #end blocks1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s(single line #block with $ on methodName s"#block $testMeth: This is my blocksThis is my blockN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(ssingle line #block with an arg s/#block $testMeth($arg='This is my block'): $argsThis is my blockN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s(single line #block with None for contents'#block $testMeth: $None test $testMeth-stest -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s+single line #block with nothing for contents1#block $testMeth: foo #end block test $testMeth-sfoo test foo -N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(RR RRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR4s             tIncludeDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(cCs1tdd}|jd|j|jdS(Ns parseTest.txtRs$numOne $numTwo(RRRR(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  cCs&tjjdr"tjdndS(Ns parseTest.txt(RRRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s##include raw of source $emptyStrings #include raw source=$emptyStringR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s'#include raw of source $blockToBeParseds$#include raw source=$blockToBeParseds$numOne $numTwoN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#include raw of 'parseTest.txt's#include raw 'parseTest.txt's$numOne $numTwoN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s #include raw of $includeFileNames#include raw $includeFileNames$numOne $numTwoN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s)#include raw of $includeFileName, with WSs* #include raw $includeFileName s$numOne $numTwoN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s!#include raw of source= , with WSs8 #include raw source='This is my $Source '*2 s&This is my $Source This is my $Source N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#include of $blockToBeParseds #include source=$blockToBeParseds1 2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s%#include of $blockToBeParsed, with WSs& #include source=$blockToBeParsed s1 2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s$#include of 'parseTest.txt', with WSs& #include source=$blockToBeParsed s1 2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s$#include of "parseTest.txt", with WSs& #include source=$blockToBeParsed s1 2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s9#include of 'parseTest.txt', with WS and surrounding texts.aoeu #include source=$blockToBeParsed aoeus aoeu 1 2aoeuN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s9#include of 'parseTest.txt', with WS and explicit closures% #include source=$blockToBeParsed# s 1 2 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR RRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs             tSilentDirectivecBs#eZdZdZdZRS(cCs|jdddS(ssimple #silents#silent $aFuncR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs$|jdd|jdddS(ssimple #silents$#silent $anObj.callIt $anObj.callArgRs.#silent $anObj.callIt ##comment $anObj.callArgN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  cCs|jdddS(ssimple #silents(#silent $anObj.callIt(99) $anObj.callArgt99N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs (RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  t SetDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZRS(cCs4|jdd|jdd|jdddS(s simple #sets #set $testVar = 'blarg' $testVarR#s#set testVar = 'blarg' $testVars(#set testVar = 'blarg'##comment $testVarN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    cCs|jdddS(s'simple #set with no WS between operandss#set $testVar='blarg'R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#set + use of vars #set $testVar = 'blarg' $testVarR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#set + use in an #includes:#set global $aSetVar = 1234 #include source=$includeBlock2s1 2 1234N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#set with a dictionarysY#set $testDict = {'one':'one1','two':'two2','three':'three3'} $testDict.one $testDict.twos one1 two2N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRscCs|jdddS(s(#set with string, then used in #if blocks,#set $test='a string' #if $test#blarg#end ifR#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(ssimple #set, gobble WSs #set $testVar = 'blarg' R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR&s cCs|jdddS(ssimple #set, don't gobble WSs #set $testVar = 'blarg'#---s ---N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR+s cCs|jdddS(ssimple #set with a lists' #set $testVar = [1, 2, 3] $testVars [1, 2, 3]N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR0s cCs|jdddS(ssimple #set global with a lists. #set global $testVar = [1, 2, 3] $testVars [1, 2, 3]N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR5s cCs|jdddS(ssimple #set global with a list and *cache Caching only works with global #set vars. Local vars are not accesible to the cache namespace. s/ #set global $testVar = [1, 2, 3] $*testVars [1, 2, 3]N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR:s cCs|jdddS(s/simple #set global with a list and **caches1 #set global $testVar = [1, 2, 3] $*5*testVars [1, 2, 3]N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRDs cCs|jdddS(s*simple #set with a list and **caches2 #set global $testVar = [1, 2, 3] $*.5*testVars [1, 2, 3]N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRIs cCs|jdddS(s!simple #set without NameMapper ons7#compiler useNameMapper = 0 #set $testVar = 1 $testVarRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRNs cCs|jdddS(ssimple #set without $s#set testVar = 1 $testVarRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRSs cCs|jdddS(ssimple #set global without $s!#set global testVar = 1 $testVarRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRXs cCs|jdddS(ssimple #set module without $s$#set module __foo__ = 'bar' $__foo__tbarN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR]s cCs$|jdd|jdddS(s##set with i,j=list style assignments#set i,j = [1,2] $i$jt12s#set $i,$j = [1,2] $i$jN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRbs  cCs$|jdd|jdddS(s%#set with (i,j)=list style assignments#set (i,j) = [1,2] $i$jRs#set ($i,$j) = [1,2] $i$jN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRis  cCs$|jdd|jdddS(s(#set with i, (j,k)=list style assignments #set i, (j,k) = [1,(2,3)] $i$j$kt123s##set $i, ($j,$k) = [1,(2,3)] $i$j$kN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRps  (RR RRRRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs(                 t IfDirectivecBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZRS(cCs|jdd|jdd|jdd|jdd|jdd|jdd|jd d|jd dd S( ssimple #if blocks#if 1 $aStr #end if sblarg s#if 1: $aStr #end if s#if 1: $aStr #end if s #if 1: ##comment $aStr #end if s#if 1 ##comment $aStr #end if s,#if 1##for i in range(10)#$i#end for##end ift 0123456789s%#if 1: #for i in range(10)#$i#end fors#if 1: #for i in range(10):$iN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRzs         cCs|jdddS(ssimple #if block, with WSs #if 1 $aStr #end if sblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s/simple #if block, with WS and explicit closuress #if 1# $aStr #end if #-- s blarg -- N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#if block using $numOnes#if $numOne $aStr #end if sblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#if block using $zeros#if $zero $aStr #end if R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#if block using $emptyStrings#if $emptyString $aStr #end if R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s,#if ... #else ... block using a $emptyStrings5#if $emptyString $anInt #else $anInt - $anInt #end ifs1 - 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s6#if ... #elif ... #else ... block using a $emptyStrings?#if $emptyString $c #elif $numOne $numOne #else $c - $c #end ifs1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s#if 'not' test, with #slurps)#if not $emptyString $aStr#slurp #end if R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs9y|jddWntk r'nX|jddS(s@#if block using $*emptyString This should barf s #if $*emptyString $aStr #end if R7sThis should barfN(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    cCsJxCd D];}y|j|dWntk r4qX|jdqWdS( sE#if block using invalid top-level $(placeholder) syntax - should barfs"#if $*5*emptyString $aStr #end if s!#if ${emptyString} $aStr #end if s!#if $(emptyString) $aStr #end if s!#if $[emptyString] $aStr #end if s #if $!emptyString $aStr #end if R7sThis should barfN(s"#if $*5*emptyString $aStr #end if s!#if ${emptyString} $aStr #end if s!#if $(emptyString) $aStr #end if s!#if $[emptyString] $aStr #end if s #if $!emptyString $aStr #end if (RpRR(Rt badSyntax((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  cCs|jdddS(sr#if ... #else if ... #else ... block using a $emptyString Same as test 8 but using else if instead of elifsB#if $emptyString $c #else if $numOne $numOne #else $c - $c #end ifs1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s5#if# ... #else # ... block using a $emptyString with s4#if $emptyString# $anInt#else#$anInt - $anInt#end ifs1 - 1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(ssingle-line #if: simples)#if $emptyString then 'true' else 'false'tfalseN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(ssingle-line #if: more complexs##if $anInt then 'true' else 'false'ttrueN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs|jdddS(s@single-line #if: with the words 'else' and 'then' in the output sM#if ($anInt and not $emptyString==''' else ''') then $str('then') else 'else'tthenN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs cCs$|jdd|jdddS(ssingle-line #if: s #if 1: foo #if 0: bar #if 1: foosfoo fooN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs  cCs4|jdd|jdd|jdddS(ssingle-line #if: #else: s#if 1: foo #elif 0: barsfoo s%#if 1: foo #elif 0: bar #else: blarg s%#if 0: foo #elif 0: bar #else: blarg sblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs    (RR RRRRRRRRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRxs$                tUnlessDirectivecBs>eZdZdZdZdZdZdZRS(cCsD|jdd|jdd|jdd|jdddS(s #unless 1s#unless 1 1234 #end unlessR7s#unless 1: 1234 #end unlesss'#unless 1: ##comment 1234 #end unlesss&#unless 1 ##comment 1234 #end unlessN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s    cCs|jdddS(s #unless 0s#unless 0 1234 #end unlesss 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s #unless $nones #unless $none 1234 #end unlesss 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#unless $numTwos"#unless $numTwo 1234 #end unlessR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#unless $numTwo with WSs/ #unless $numTwo 1234 #end unless R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR% s cCs8|jdd|jdd|jddd dS( ssingle-line #unlesss#unless 1: 1234R7s#unless 0: 1234Rs#unless 0: 1234 is1234 Ns 1234 1234 (Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR* s(RR RRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s      tPSPcBskeZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( cCsdS(N(R~(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRV1 scCs|jdddS(ssimple <%= [int] %>s <%= 1234 %>RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR4 scCs|jdddS(ssimple <%= [string] %>s<%= 'blarg' %>R#N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR8 scCs|jdddS(ssimple <%= None %>s <%= None %>R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR< scCs|jdddS(ssimple <%= [string] %> + $anInts<%= 'blarg' %>$anIntRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR? scCs|jdddS(ssimple <%= [EXPR] %> + $anInts <%= ('blarg'*2).upper() %>$anIntt BLARGBLARG1N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRC scCs|jdddS(sfor loop in <%%>s<% for i in range(5):%>1<%end%>t11111N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRG scCs|jdddS(s!for loop in <%%> and using <%=i%>s$<% for i in range(5):%><%=i%><%end%>RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRK scCs|jdddS(s#for loop in <% $%> and using <%=i%>s/<% for i in range(5): i=i*2$%><%=i%><%end%>t02468N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRO scCs|jdddS(s3for loop in <% $%> and using <%=i%> plus extra texts0<% for i in range(5): i=i*2$%><%=i%>-<%end%>s 0-2-4-6-8-N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRT scCs-idd6g|_d}|j|ddS(s% Using getVar and write within a PSP itmesrThis is my template <% me = self.getVar('me') if isinstance(me, int): write('Bork') else: write('Nork') %>sThis is my template BorkN(RURp(RRc((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRY s( RR RVRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR0 s          tWhileDirectivecBseZdZRS(cCs|jdddS(ssimple #while with a counters:#set $i = 0 #while $i < 5 $i#slurp #set $i += 1 #end whileRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRh s (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR g stContinueDirectivecBseZdZdZRS(cCs|jdddS(s#continue with a #whilesq#set $i = 0 #while $i < 5 #if $i == 3 #set $i += 1 #continue #end if $i#slurp #set $i += 1 #end whilet0124N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRn scCs|jdddS(s#continue with a #forsE#for $i in range(5) #if $i == 3 #continue #end if $i#slurp #end forR N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR{ s(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR m s tBreakDirectivecBseZdZdZRS(cCs|jdddS(s#break with a #whilesW#set $i = 0 #while $i < 5 #if $i == 3 #break #end if $i#slurp #set $i += 1 #end whilet012N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jdddS(s#break with a #forsB#for $i in range(5) #if $i == 3 #break #end if $i#slurp #end forRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s t TryDirectivecBs5eZdZdZdZdZdZRS(cCs|jdddS(ssimple #try s #try 1234 #except blarg #end trys1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s##try / #except with #raise s-#try #raise ValueError #except blarg #end trysblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s?#try / #except with #raise + WS Should gobble s9 #try #raise ValueError #except blarg #end trysblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s[#try / #except with #raise + WS and leading text Shouldn't gobble s<--#try #raise ValueError #except blarg #end try#--s -- blarg --N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s*nested #try / #except with #raise s`#try #raise ValueError #except #try #raise ValueError #except blarg #end try #end trysblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s    t PassDirectivecBseZdZdZRS(cCs|jdddS(s(#pass in a #try / #except block s-#try #raise ValueError #except #pass #end tryR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s-#pass in a #try / #except block + WS sB #try #raise ValueError #except #pass #end tryR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s tAssertDirectivecBs#eZdZdZdZRS(cCs|jdddS(ssimple #assert s!#set $x = 1234 #assert $x == 1234R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs |d}|jt|dS(s"simple #assert that fails cSs|jddfdS(Ns #set $x = 1234 #assert $x == 999R7(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyttest s N(tfailUnlessRaisestAssertionError(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(ssimple #assert with WS s'#set $x = 1234 #assert $x == 1234 R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s  tRaiseDirectivecBs#eZdZdZdZRS(cCs |d}|jt|dS(sBsimple #raise ValueError Should raise ValueError cSs|jddfdS(Ns#raise ValueErrorR7(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s N(Rt ValueError(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs |d}|jt|dS(sH#raise ValueError in #if block Should raise ValueError cSs|jdddS(Ns #if 1 #raise ValueError #end if R7(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s N(RR(RR((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(sK#raise ValueError in #if block Shouldn't raise ValueError s+#if 0 #raise ValueError #else blarg#end if sblarg N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s tImportDirectivecBskeZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( cCs|jdddS(s#import math s #import mathR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s1#import math + WS Should gobble s #import math R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(sK#import math + WS + leading text Shouldn't gobble s -- #import math s -- N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#from math import syn s#from math import cosR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR& s cCs|jdddS(s:#from math import cos + WS Should gobble s #from math import cos R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR, s cCs|jdddS(sL#from math import cos + WS + leading text Shouldn't gobble s -- #from math import cos s -- N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR3 s cCs|jdddS(s(#from math import cos -- use it s#from math import cos $cos(0)s1.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR: s cCs|jdddS(s6#from math import cos,tan,sin -- and use them s7#from math import cos, tan, sin $cos(0)-$tan(0)-$sin(0)s 1.0-0.0-0.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR@ s cCs|jdttdS(s"#import os.path -- use it s$#import os.path $os.path.exists('.')N(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRF s cCs|jdttdS(s=#import os.path -- use it with NameMapper turned off se## #compiler-settings useNameMapper=False #end compiler-settings #import os.path $os.path.exists('.')N(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRM scCs|jdddS(s#from math import * s(#from math import * $pow(1,2) $log10(10)s1.0 1.0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRX s ( RR RRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s          tCompilerDirectivecBseZdZdZRS(cCs|jdddS(s)overriding the commentStartToken sC$anInt##comment #compiler commentStartToken = '//' $anInt//comment s1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR` scCs|jdddS(s7overriding and resetting the commentStartToken sc$anInt##comment #compiler commentStartToken = '//' $anInt//comment #compiler reset $anInt//comment s1 1 1//comment N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRi s(RR RR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR_ s tCompilerSettingsDirectivecBs#eZdZdZdZRS(cCs|jdddS(s,overriding the cheetahVarStartToken sq$anInt #compiler-settings cheetahVarStartToken = @ #end compiler-settings @anInt #compiler-settings reset $anInt s1 1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRw scCs|jdddS(s+overriding the directiveStartToken sf#set $x = 1234 $x #compiler-settings directiveStartToken = @ #end compiler-settings @set $x = 1234 $x s 1234 1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jdddS(s)overriding the commentStartToken sa$anInt##comment #compiler-settings commentStartToken = // #end compiler-settings $anInt//comment s1 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s(RR RRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRu s tjavatExtendsDirectivecBs,eZdZdZdZdZRS(cCs$|jdd|jdddS(s(#extends Cheetah.Templates._SkeletonPagesp#from Cheetah.Templates._SkeletonPage import _SkeletonPage #extends _SkeletonPage #implements respond $spacer() s5 s~#from Cheetah.Templates._SkeletonPage import _SkeletonPage #extends _SkeletonPage #implements respond(foo=1234) $spacer()$foo s91234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s7#extends Cheetah.Templates.SkeletonPage without #importsF#extends Cheetah.Templates.SkeletonPage #implements respond $spacer() s5 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jdddS(sD#extends Cheetah.Templates.SkeletonPage.SkeletonPage without #importsS#extends Cheetah.Templates.SkeletonPage.SkeletonPage #implements respond $spacer() s5 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR scCs|jdddS(s)#extends with globals and searchList tests]#extends Cheetah.Templates.SkeletonPage #set global g="Hello" #implements respond $g $numOne sHello 1 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s(RR RRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s   tSuperDirectivecBseZdZRS(cCs(tjd}|jd}d}dS(NsR$foo $bar(99) #def foo: this is base foo #def bar(arg): super-$args #implements dummy #def foo #super This is child foo #super(trans=trans) $bar(1234) #end def #def bar(arg): #super($arg) sZthis is base foo This is child foo this is base foo super-1234 super-99(RR`R(Rttmpl1ttmpl2Rq((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s   (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR stImportantExampleCasescBseZdZRS(cCs|jdddS(s"how to make a comma-delimited listsW#set $sep = '' #for $letter in $letterList $sep$letter#slurp #set $sep = ', ' #end for sa, b, cN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s(RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR  stFilterDirectivecBszeZeZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd ZRS( cCs itd6S(NtuseFilterArgsInPlaceholders(R(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRa scCs$|jdd|jdddS(s#filter Filter s#filter Filter $none#end filterR7s#filter Filter: $noneN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s  cCs|jdddS(s$#filter ReplaceNone with WS s!#filter Filter $none#end filterR7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s#filter MaxLen -- maxlen of 5s3#filter MaxLen ${tenDigits, $maxlen=5}#end filterRN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s$#filter MaxLen -- no maxlen s(#filter MaxLen ${tenDigits}#end filtert 1234567890N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s'#filter WebSafe -- basic usage s)#filter WebSafe $webSafeTest#end filtersabc <=> &N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s&#filter WebSafe -- also space s6#filter WebSafe ${webSafeTest, $also=' '}#end filtersabc <=> &N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s=#filter WebSafe -- also space, without $ on the args s5#filter WebSafe ${webSafeTest, also=' '}#end filtersabc <=> &N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s*#filter Strip -- trailing newline s #filter Strip $strip1#end filtersstrippable whitespace N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR! s cCs|jdddS(s,#filter Strip -- no trailing newine s #filter Strip $strip2#end filtersstrippable whitespaceN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR' s cCs|jdddS(s$#filter Strip -- multi-line s #filter Strip $strip3#end filtersstrippable whitespace 1 2 3 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR- s cCs|jdddS(sC#filter StripSqueeze -- canonicalize all whitespace to ' ' s'#filter StripSqueeze $strip3#end filtersstrippable whitespace 1 2 3N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR3 s (RR R R[RaRRRRRRRRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR! s          t EchoDirectivecBseZdZRS(cCs|jdddS(s#echo 1234 s #echo 1234RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR; s (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR$: scBseZdZRS(cCs|jdddS(s#silent 1234 s #silent 1234R7N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRB s (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRA stErrorCatcherDirectivecBseZRS((RR (((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR%H st VarExistscBs5eZdZdZdZdZdZRS(cCs|jdttdS(s$varExists('$anInt') s$varExists('$anInt')N(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRN s cCs|jdttdS(s$varExists('anInt') s$varExists('anInt')N(RpRR(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRT s cCs|jdttdS(s$varExists('$anInt') s$varExists('$bogus')N(RpRR (R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRZ s cCs|jdddS(s5$varExists('$anInt') combined with #if false s/#if $varExists('$bogus') 1234 #else 999 #end ifs999 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR` s cCs|jdddS(s4$varExists('$anInt') combined with #if true s.#if $varExists('$anInt') 1234 #else 999#end ifs1234 N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRf s (RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR&L s     tGetVarcBs5eZdZdZdZdZdZRS(cCs|jdddS(s$getVar('$anInt') s$getVar('$anInt')RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRm s cCs|jdddS(s$getVar('anInt') s$getVar('anInt')RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRs s cCs|jdddS(s$self.getVar('anInt') s$self.getVar('anInt')RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyRy s cCs|jdddS(s$getVar('bogus', 1234) s$getVar('bogus', 1234)RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCs|jdddS(s $getVar('$bogus', 1234) s$getVar('$bogus', 1234)RN(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR RRRRR(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR'l s     tMiscComplexSyntaxcBseZdZRS(cCs|jdddS(sComplex use of {},[] and () in a #set expression ---- #set $c = {'A':0}[{}.get('a', {'a' : 'A'}['a'])] $c s3#set $c = {'A':0}[{}.get('a', {'a' : 'A'}['a'])] $ct0N(Rp(R((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s (RR R(((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR( stCGIcBsPeZdZeZdZdZeZdZdZ dZ dZ RS(sKCGI scripts with(out) the CGI environment and with(out) GET variables. cCsdtjd|jddddd}|j|d|jdS(sA (pseudo) Webware servlet. This uses the Python syntax escape to set self._CHEETAH__isControlledByWebKit. We could instead do '#silent self._CHEETAH__isControlledByWebKit = True', taking advantage of the fact that it will compile unchanged as long as there's no '$' in the statement. (It won't compile with an '$' because that would convert to a function call, and you can't assign to a function call.) Because this isn't really being called from Webware, we'd better not use any Webware services! Likewise, we'd better not call $cgiImport() because it would be misled. s##extends Cheetah.Tools.CGITemplate s#implements respond s7<% self._CHEETAH__isControlledByWebKit = True %>#slurp s$cgiHeaders#slurp s Hello, world!N(R.RpR0(RRW((sL/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/SyntaxAndOutput.pyR s cCsU|jdtjd s                    _='<%Mu+$  z?v   $%2 c  /r+ mIz+7. P'- L   KJ\