mς ‰%άGc@s[dklZdkZdkZdkZdZdefd„ƒYZdfd„ƒYZdS((s spyceModuleNs–Include module is used to assist the inclusion of abitrary elements/files into a Spyce file. It can also support the notion of an 'inclusion context'.tincludec BsVtZd„Zdd„Zdd„Zdd„Zddddddddd„ZRS(NcCsd|_d|_dS(N(tNonetselftcontexttvars(R((t3/home/holguin2/public_html/spyce/modules/include.pytstarts c Cstid|ƒt|iiƒƒtijo d‚nti ||ii ƒƒ}d} }}z|ii|ƒ}|iƒ}|iiƒ}x(|iƒD]}|i|||ƒq W|i|iiƒ|iiƒƒ|iddddƒ}||_t|ƒthƒjot|ƒ|_n|iiƒi |ƒ|i!ƒ} |iiƒi"ƒWd|o|i#ƒ|i$|ƒnX| S(sInclude a Spyce files including s6Maximum stack depth exceeded! (infinite include loop?)RiN(%tspycetDEBUGturltlenRt_apitgetStackt MAX_STACKt spyceUtilturl2filet getFilenametfilenameRtresulttstcodet spyceFilet newWrappert getModulestmodulestkeystnamet setModulet spyceInitt getRequestt getResponset _startModuletincmodRttypet spyceVarsRtappendt spyceProcesstpopt spyceDestroyt returnWrapper( RR RRRRR RRR((RRs4   "   cCsF|iidƒ}|iƒz|i||ƒ}Wd|i ƒ}X|S(Ntstdout( RR t getModuleR(tpushRR RRR%toutput(RR RR(RR+((RtspyceStr.s  icCsƒtiitii|iiƒƒ|ƒ}d}z6|o d}nd}t ||ƒ}|i ƒ}Wd|o|iƒnX|S(s#Include a plain text file, verbatimtrbtrN(tostpathtjointdirnameRR RtfileRtftbinarytmodetopentreadtbuftclose(RR3R5R4R9R6((Rtdump6s* c Csϋ|p d}n|p d}n|p d}n|p d}n|p d}n|p d}nd k}d kl}|o|p| o| o d ‚n|o]d }z:t i ||iiƒƒ} t| d ƒ}|iƒ}Wd |o|iƒnXn|iid ƒi} yΗ|i|ƒ}|ƒ}g}|i|dƒ|i|dƒxT|D]L\} } }}| |i joΎx΄t!o¬|i"i#| ƒ}|p|i| | ƒƒPn| |i%ƒ } | |i'ƒ}|i| | ƒƒ|i|dƒ|i| |i)dƒƒƒ|i|dƒ|} qŒWqgn| |i*|i+|i,fjo&|i|dƒ|i|dƒnε| |i-fjo&|i|dƒ|i|dƒn¬| |i.fjo&|i|dƒ|i|dƒns| |i/fjo&|i|dƒ|i|dƒn:| |i0fjo&|i|dƒ|i|dƒn|i| | ƒƒ| |i1|i2fjo|i|i3ƒƒqgqgWx|o|i|i3ƒƒqΊW|i4ƒSWn‚d‚nXd S(sEmit formatted Spyce codess ssssssN(sStringIOs/must specify either url or string, and not bothR.t transformiiserror tokenizing!(ss (ss(ss(ss(ss(ss(5thtmlRtevalt directivetcommentttagt spyceCompiletStringIOR tstringRR4RRRR RRR7R8R:R)t html_encodet spyceTokenizettokensR9t markupstacktwriteR#R!ttextt_tT_TEXTtTruet RE_LIB_TAGtsearchtmRtpretendtposttgrouptT_STMTtT_CHUNKtT_CHUNKCtT_LAMBDAtT_EVALtT_DIRECTtT_CMNTt T_END_CMNTtT_ENDR%tgetvalue(RR RDR=RR>R?R@RARQRJRERR!RGRBRSR9RKRHRCR4RP((Rt spycecodeBsŠ          " &&&&&(t__name__t __module__RRRR,R;R_(((RRs     R"cBs#tZd„Zd„Zd„ZRS(NcCs||id