RE: [Zope] aborting DTML parsing
-----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
Hello, Michel Pelletier wrote:
-----Original Message----- From: Jan Stohner [mailto:stohner@drze.de] 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). 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
This is a solution, but i have to modify all my DTML documents. All documents are beginning with "<dtml-var standard_html_header>" and i COULD change all documents to "<dtml-try><dtml-var standard_html_header>....<dtml-except>...", but this is not my preferred solution. What about raising an error in a DTML document, but catching it in the Zope sources? Is this possible, and where do i catch the exception? Jan -- Dipl.-Inform. Jan Stohner ------------------ stohner@drze.de Deutsches Referenzzentrum für Ethik in den Biowissenschaften Niebuhrstraße 53 -- D-53113 Bonn -- Telefon: +49 228/73-1932
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
This is a solution, but i have to modify all my DTML documents. All documents are beginning with "<dtml-var standard_html_header>" and i COULD change all documents to "<dtml-try><dtml-var standard_html_header>....<dtml-except>...", but this is not my preferred solution.
This is a problem I've also encountered and, as you mention, the try/except requires modifying all pages. I'd also like to find a better solution. Is there no equivalent of Python's sys.exit(0) ? chas
I hope I don't get flamed off this list, but here goes... I have recently had to delve into ColdFusion for a customer, and there are some tags that would certiainly be useful. <CFABORT> for example, stops execution of a template. They have some nice constructs in the <CFLOOP> tag as well, allowing loops equivalent to while, for, and <dtml-in> loops. There is a <CFSWITCH><CFCASE></CFCASE></CFSWITCH> construct that I would certainly find useful, too. Don't worry, I have no intention of abandonning zope in favour of CF, which is far superiour in SO many ways, but there is no reason not to use their good ideas... Didn't I see some reference to a <dtml-return> tag in version 2.1. I haven't checked the docs for new tags, but I thought I saw some email that mentioned such a tag. I might mention that there was no mention whatsoever of new dtml tags in the CHANGES.TXT file. --sam chas wrote:
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
This is a solution, but i have to modify all my DTML documents. All documents are beginning with "<dtml-var standard_html_header>" and i COULD change all documents to "<dtml-try><dtml-var standard_html_header>....<dtml-except>...", but this is not my preferred solution.
This is a problem I've also encountered and, as you mention, the try/except requires modifying all pages. I'd also like to find a better solution.
Is there no equivalent of Python's sys.exit(0) ?
chas
_______________________________________________ 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 )
participants (4)
-
chas -
Jan Stohner -
Michel Pelletier -
Sam Gendler