m {%Gc@sdZdkZdkZdkZdkZdkZdkZedZdfdYZ dfdYZ de fdYZ d fd YZ d fd YZ dS( sSpyce tags functionality.Nc Kst|tiptd|i|id} d|di g}|i D]\}}|d||fqP~f}| idi |i||}||dS(Nsexpected spyceWrapper; got %st spylambdas,[[ from spyceException import * ]] <%s %s />t s%s="=%s"t,(t isinstancetapitspycet spyceWrappertAssertionErrort __class__t getModuleRttagnametjoint_[1]tkwargst iteritemstkeytvaluetcodetdefinetiterkeystmemoizetlamb( RR RR RRRRR R((t,/home/holguin2/public_html/spyce/spyceTag.pytinvokeSingletons $J$tspyceTagLibrarycBsDtZdZdZedZdZgZdZdZ RS(s-All Spyce tag libraries should subclass this.cCs:||_h|_x!|iD]}||i|iLs  cCsyt||iSWntj o}d|jon|idd}y|ii |}Wnt j o |nX||i| to send x into parent scope. _Must set class.exports or export method will not be called._ N(R.(R((RtexportscCs"|o|ii|ndS(s5Process tag body; return true to repeat (if loops==1)iN(t _contentsRRVtwrite(RR[((RtbodyscCsdS(sProcess end tagN((R((RtendscCsdS(s3Process any exception thrown by tag (if catches==1)N((Rtex((Rtcatchs(R+R,R-R.R R>RBRLRNRORPRQR:RURVRWt classcodethandlersRtbuffert conditionaltloopstcatchestmustendtexportsRXRYRZR]R^R`(((RR/3sJ                t spyceTagPluscBshtZdZdZdZdZdZdZdZdZdZd Zd ZRS( s(An easier spyceTag class to work with...cCs|ii|S(sReturn a Spyce module referenceN(RR4R R(RR((RR scCs1|i|}|pd|i|fn|S(Ns1%s tag must be used inside a parent %s active tag(RR:t parentnameR&R(RRjR&((RtparentRequiredscGsZxS|D]K}y|i|}Wntj o dSnX|ptd|qqWdS(Ns"attribute "%s" should not be empty(tnamesRRR=RtKeyErrorR<(RRlRR((RtsyntaxNonEmptys cGsZxS|D]K}y|i|}Wntj o dSnX|ptd|qqWdS(Ns"attribute "%s" should not be empty(RlRRR=RRmR<(RRlRR((RRns cGsZxS|D]K}y|i|}Wntj o dSnX|ptd|qqWdS(Ns"attribute "%s" should not be empty(RlRRR=RRmR<(RRlRR((RRns cGsZxS|D]K}y|i|}Wntj o dSnX|ptd|qqWdS(Ns"attribute "%s" should not be empty(RlRRR=RRmR<(RRlRR((RRns cGsZxS|D]K}y|i|}Wntj o dSnX|ptd|qqWdS(Ns"attribute "%s" should not be empty(RlRRR=RRmR<(RRlRR((RRns cCs_y|i|}Wntj o dSnX||jo#td|di|fndS(Ns#attribute "%s" should be one of: %ss, (RR=RRRmtvalidSetR<R (RRRoR((RtsyntaxValidSets   cCs|iptdndS(s.Ensure that this tag is paired i.e. open/closessingleton tag not allowedN(RR5R<(R((RtsyntaxPairOnlys cCs|iotdndS(s*Ensure that this tag is single i.e. spaired tag not allowedN(RR5R<(R((RtsyntaxSingleOnlys ( R+R,R-R RkRnRpRqRr(((RRis          tspyceTagCheckercBsJtZdZddZdZdZdZdZdZ RS(NcCs||_h|_g|_dS(N(tserverRt_servert_taglibst_stack(RRt((RR s  cCs|p |}ny/|ii|||||i||ft i i dt itid||f|nXdS(Ns%s sunable to load module: %s (%s)(tlibastlibnameRRut loadModuletlibfromtrel_fileRvt SyntaxErrorRJtsyststdoutR\t spyceUtiltexceptionStringtspyceExceptiontspyceSyntaxErrortinfo(RRyR{RxR|R((RtloadLibs /c Cs|\}}|i||f} y#| id|dd||dSWn6t i t i tid||f|nXdS(Nsunknown tag "%s:%s"(RyR{RRvtlibR(R.RR$tpairRtDEBUGRRRRR( Rt.2RR#R$RRRyR{R((RR(s #c Cs|\}}|i||f}y|i|SWnltit i d|||di g}|i D]} || iqi~f}ti||nXdS(Ns.unknown tag "%s:%s" (known tags in %s are: %s)R(RyR{RRvRR!RRRRRR R RtttsRRR( RRRRRyR{RR RR((RR! s @cCs|\}}|i||f|d|||}yt i |i \} } } }|ot|}nd}| dt| |!} x5| D]-} | |jotd|| fqqWxL|D]D} | | jo1| o)| o!| djotd| qqW|i}Wn@tj o4}tititit||nX|oti||n|o |i i!||||fndS(Niis/"%s" tag call missing compulsory "%s" attributeR0sunexpected attribute "%s"("RyR{RR(RR.R$RRRtinspectt getargspecRYtargstvarargstvarkwtdefaultstlent n_defaultstLtattrR<RXterrorRERRRRRRtstrRwtappend(RRRR$RRRyR{RRRRRRRERRR((RtstartTags. $ *c Cs|\}}y|ii\}} }}Wn%t j ot i d|nX|| |f|||fjo t i d||f|ndS(Nsunmatched close tags%unmatched close tag, expected <%s:%s>(RyR{RRwtpoptlibname1tlibfrom1tname1tinfo1t IndexErrorRRRR( RRRRRyR{RRRR((RtendTag6s cCs?|io1|ii\}}}}tid|ndS(Nsunmatched open tag( RRwRRyR{RRRR(RRRyRR{((RR*?s ( R+R,R R.RR(R!RRR*(((RRss    R<cBstZdZdZRS(NcCs ||_dS(N(RRt_str(RR((RR JscCs|iS(N(RR(R((Rt__repr__Ls(R+R,R R(((RR<Is (R-R~RRRRt spyceModuletFalseRRR/RiRsR<( RRRRRRRR~R/R<RiRsR-((Rt? s <T