[Zope] Exiting a Loop

David H bluepaul at earthlink.net
Wed Jun 15 16:36:17 EDT 2005


Asad,
You want to break out of a DTML loop but there is no loop breaking DTML 
syntax. 

Here is another candidate DTML work-around:

<dtml-in someSequence>
  <dtml-if someCondition> 
      whatever you do in the loop
  </dtml-if>
</dtml-in>

That way, you can avoid processing past a certain point, just that the 
loop will run until the sequence reached the end.  Of course if your 
sequence is huge then this would be costly in terms of processing time 
and then you should play the python card.

David





Jim Abramson wrote:

>Did you try <dtml-try> around the loop and <dtml-raise> inside of it?
>Never done this myself, just a thought.
>
>Jim
>
>
>  
>
>>-----Original Message-----
>>From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On 
>>Behalf Of J Cameron Cooper
>>Sent: Wednesday, June 15, 2005 1:37 PM
>>To: Asad Habib
>>Cc: zope at zope.org
>>Subject: Re: [Zope] Exiting a Loop
>>
>>Asad Habib wrote:
>>    
>>
>>>Yes, I should not be doing this but I am using DTML not ZPT 
>>>      
>>>
>>and since 
>>    
>>
>>>DTML provides programming functionality and in this case 
>>>      
>>>
>>the ability 
>>    
>>
>>>to loop, there should be a way to exit a loop as well.
>>>      
>>>
>>DTML is not a complete programming language; it simply provides some
>>(too-) familiar structures. You may try to treat it as such, 
>>and can get away with it to a certain extent, but you may run 
>>into limitations.
>>
>>If you treat it as a templating engine (which it is) you will 
>>find it complete.
>>
>>		--jcc
>>--
>>"Building Websites with Plone"
>>http://plonebook.packtpub.com/
>>
>>Enfold Systems, LLC
>>http://www.enfoldsystems.com
>>_______________________________________________
>>Zope maillist  -  Zope at zope.org
>>http://mail.zope.org/mailman/listinfo/zope
>>**   No cross posts or HTML encoding!  **
>>(Related lists -
>> http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>>    
>>
>_______________________________________________
>Zope maillist  -  Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>__________ NOD32 1.1141 (20050615) Information __________
>
>This message was checked by NOD32 antivirus system.
>http://www.nod32.com
>
>
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050615/2bd28226/attachment.htm


More information about the Zope mailing list