Why there isnt a dtml-while function in Zope? How to implement it with dtml? how to do a simple while x != y in dtml? Thanks in advance... -- --------------------------- Diego Rodrigo Neufert -webmaster --------------------------- (Magic Web Design) (email) (diego@magicwebdesign.com.br) (curitiba) (pr)
Diego Rodrigo Neufert wrote:
Why there isnt a dtml-while function in Zope?
DTML is not meant to be used for general purpose, logic programming. It's a presentation and layout language. Additionally, a while construct would allow you to create indeterminate loops: <dtml-while 1> ... </dtml-while> and you're not allowed to loop indefinately in DTML. It's against the rules. <dtml-in> does all the looping you need over a python sequence, since DTML doesn't let you build infinite sequences, all loops terminate. The solution to your problem is to you Python Methods. http://dev.zope.org/Members/4am/PythonMethod Python does have a while construct and is indented for programming logic. -Michel
Hi Diego, DTML is set up with (some) care taken so that it can't run off with the CPU and (possibly) take forever. Depending on the circumstances you can probably get the effect of a 'while' using 'if' statements. You'll probably need to convert your iteration logic so that it looks like it's looping over a list of objects... one easy trick might be: <dtml-let maxIterations="20"> <dtml-in "range(maxIterations)"> <dtml-if "x != y"> Do something conditional.... </dtml-if> </dtml-in> </dtml-let> Assuming you can specify an upper limit on the number of iterations required. -steve
"Diego" == Diego Rodrigo Neufert <diego@magicwebdesign.com.br> writes:
Diego> Why there isnt a dtml-while function in Zope? How to Diego> implement it with dtml? how to do a simple while x != y in Diego> dtml? Diego> Thanks in advance... Diego> -- --------------------------- Diego Rodrigo Neufert Diego> -webmaster --------------------------- (Magic Web Design) Diego> (email) (diego@magicwebdesign.com.br) (curitiba) (pr) Diego> _______________________________________________ Zope Diego> maillist - Zope@zope.org Diego> http://lists.zope.org/mailman/listinfo/zope ** No cross Diego> posts or HTML encoding! ** (Related lists - Diego> http://lists.zope.org/mailman/listinfo/zope-announce Diego> http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Diego Rodrigo Neufert -
Michel Pelletier -
Steve Spicklemire