[Zope] aborting DTML parsing

Michel Pelletier michel@digicool.com
Fri, 26 Nov 1999 14:28:31 -0500


> -----Original Message-----
> From: Jan Stohner [mailto:stohner@drze.de]
> Sent: Friday, November 26, 1999 10:13 AM
> To: zope@zope.org
> Subject: [Zope] aborting DTML parsing
> 
> 
> Hello,
> 
> i know that i can use <dtml-return> to return data from a 
> DTML method. For
> example, when standard_html_header is called from a DTML 
> document and i use
> <dtml-return> in standard_html_header, i'm back in the 
> document with the
> result from the return tag.
> 
> I am searching for a method to stop rendering at all, no 
> matter how deep
> method calls are nested (a "return" would now stop rendering of the
> complete document).
> 
> I searched the Mailing List archive but was only able to find 
> a similar
> question (from Anthony Baxter, April 21), but not an answer.
> 
> Is there a quick solution? I had the idea to implement a 
> <dtml-quit> tag
> which is similar to <dtml-return> but raises a different 
> exception, but i
> wasn't able to find the right place in the sources to catch 
> this exception.

Just raise an error way down deep, and catch it at the higher method
with <dtml-try> and <dtml-except>.  I think these tags were added in
2.0.0

-Michel