mò +á¸Ec@sxdZdZddd!ZdklZlZlZlZdfd„ƒYZdfd „ƒYZ d e fd „ƒYZ d S( sTConditional insertion Conditional insertion is performed using 'if' and 'else' commands. To include text when an object is true using the EPFS format, use:: %(if name)[ text %(if name)] To include text when an object is true using the HTML format, use:: text where 'name' is the name bound to the object. To include text when an object is false using the EPFS format, use:: %(else name)[ text %(else name)] To include text when an object is false using the HTML format, use:: text Finally to include text when an object is true and to include different text when the object is false using the EPFS format, use:: %(if name)[ true text %(if name)] %(else name)[ false text %(else name)] and to include text when an object is true and to include different text when the object is false using the HTML format, use:: true text false text Notes: - if a variable is nor defined, it is considered to be false. - A variable if only evaluated once in an 'if' tag. If the value is used inside the tag, including in enclosed tags, the variable is not reevaluated. s6$Id: DT_If.py 40218 2005-11-18 14:39:19Z andreasjung $s$Revision: 1.19 $i iþÿÿÿ(s ParseErrors parse_paramss name_paramsstrtIfcBs)tZdZdZdZdZd„ZRS(Ntelseteliftiftc Csæ|d\}}} t|ddddƒ}t|ddƒ\}}||_ |djo |}n |i }|| ig} |dddjov|d\}}} |d=t|ddƒ}|o6t|ddƒ\}}||jo td‚qùn| i}nd}x¢|dD]–\}}} |djo td‚nt|ddddƒ}t|d dƒ\}}|djo |}n |i }| i|ƒ| i| iƒqW|dj o| i|ƒndt| ƒ|_dS(NitnameRtexprRiiÿÿÿÿRsname in else does not match iftins*more than one else tag for a single if tagRti(sname in else does not match ifsin(s*more than one else tag for a single if tagsin(R(tblocksttnametargstsectiont parse_paramst name_paramRRtselft__name__tNonetcondtevaltsectionstenamet ParseErrortelsestappendttuplet simple_form( RR RRRR RRR RR ((t5/data/zmath/zope/lib/python/DocumentTemplate/DT_If.pyt__init__Ys@            (selseselif(Rt __module__tblockContinuationsRRRRR(((RRSs tUnlesscBstZdZfZd„ZRS(NtunlesscCs|d\}}}t|ddddƒ}t|ddƒ\}}|djo |}n |i }d|d|if|_ dS(NiRRRR iR( R R R R R RRRRRRRR(RR RRR RR R ((RRs  (RRRRR(((RR}stElsecBstZdZRS(NR(RRR(((RR!‰sN( t__doc__t __rcs_id__t __version__tDT_UtilRR RtstrRRR!( RR!RR"R#R&R$RR R((Rt? s A *