[Zope] Strange Behaviour in my dtml-method
Karl Munroe
komunroe@uwimona.edu.jm
Tue, 31 Jul 2001 12:21:10 -0800
I am having some problems with a little bit of code I wrote that is of the
following format :
1 <dtml-call SomeExpensiveFunction>
2 <dtml-in someListIHave>
3 <dtml-if "_['sequence-item'] == ''">
4 <dtml-call "RESPONSE.redirect('page_to_see_error_message')">
5 </dtml-if>
6 </dtml-in>
7 <dtml-call AddSomethingToMyDatabase>
8 <dtml-call "RESPONSE.redirect('page_to_see_results')">
The above code processes some data that I input from a form. I left a field
blank and I would be redirected at line 4 to see the error message.
Unfortunately I got something else. Instead of stopping at line 4 the above
code redirects me at line 8 executing line 7 in the process.
# When I redirect from a dtml method, is such a redirect functionally
equivalent to a return statement in C that causes processing to stop???
#I interpret that behaviour to mean that the the above code executes until
the loop is finished and then continues to execute. The result is that I am
redirected twice, first to see the error message and finally to see the
results. If this is the case, is there a tag to stop looping and "return".
Thanks in advance
Karl