But that's more like a for loop. No test condition. Basically, I want to keep redoing a method until a condition is met. -----Original Message----- From: Daniel Rusch [mailto:drusch@globalcrossing.com] Sent: Wednesday, July 26, 2000 3:19 PM To: Leichtman, David J Cc: 'zope@zope.org' Subject: Re: [Zope] while Try: <dtml-in "_.range(1,10)"> <dtml-var sequence-item> </dtml-in> "Leichtman, David J" wrote:
Is there an easy way to simulate the functionality of a while loop in DTML?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
This is real ugly, but you asked (untested, but you get the idea): <dtml-try> <dtml-in "_.range(1000)"> <dtml-if whileCondition> <!-- Your logic test --> <!-- Do stuff in while loop --> <dtml-else> <dtml-raise type="conditionFalse">errormsg</dtml-raise> </dtml-if> </dtml-in> <dtml-except conditionFalse> <!-- Fall out of 'while' loop. --> <dtml-else> <dtml-raise type="RangeError">Oops! Exception never raised.</dtml-raise> </dtml-try> This only works if the loop will cycle less than 1000 times. Needless to say, this is done a lot easier in Python. On Wed, Jul 26, 2000 at 05:46:18PM -0500, Leichtman, David J wrote:
But that's more like a for loop. No test condition. Basically, I want to keep redoing a method until a condition is met.
-----Original Message----- From: Daniel Rusch [mailto:drusch@globalcrossing.com] Sent: Wednesday, July 26, 2000 3:19 PM To: Leichtman, David J Cc: 'zope@zope.org' Subject: Re: [Zope] while
Try:
<dtml-in "_.range(1,10)"> <dtml-var sequence-item> </dtml-in>
"Leichtman, David J" wrote:
Is there an easy way to simulate the functionality of a while loop in DTML?
-- Patrick Lewis <pl@teleport.com>
participants (2)
-
Leichtman, David J -
Patrick Lewis