[Zope] Looping in DTML
Tony McDonald
tony.mcdonald@ncl.ac.uk
Tue, 17 Aug 1999 11:27:21 +0100
At 11:06 am +0100 17/8/99, Phil Harris wrote:
>As for breaking out of a loop, how about (extremely untested):
>
><dtml-try>
> <dtml-in "_.range(total_count)">
> <dtml-var sequence-item>
> <dtml-if some_thing>
> <dtml-raise someexception></dtml-raise>
> </dtml-if>
> </dtml-in>
><dtml-except someexception>
> <dtml-comment>
> do nothing
> </dtml-comment>
></dtml-try>
>
>the raise tag should then jump to the except tag and therefore out of the
>loop or something like that, maybe, possibly, ;).
>
>HTH
>
>Phil
>phil@philh.org
(Phils machine goes --bleep--)
I *was* going to mention about <dtml-raise > but I knew Phil would be
lurking, and he doesn't get out much! :)
To add *some* content to this mail, I *think* you can do _.xrange()
too, so that largeish loops can also be done...checking
source....(DT_Util.py) nope. I was wrong. No xrange, but _.range()
has got a limit of 1000, so you won't be doing any infinite loops
using *that* function...
hth
tone
------
Dr Tony McDonald, FMCC, Networked Learning Environments Project
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2