[Zope] REQUEST variables in exceptions

Ramiro Brito Willmersdorf rbw@demec.ufpe.br
Tue, 26 Sep 2000 01:55:45 -0300


I have a DTML document with the following structure:

<dtml-var standard_html_header>
   <dtml-call "my_external_method(REQUEST)">
      <p> Report that everything was ok and wait for ack.
      <form method=POST action=index_html> <input type=submit value="OK"> </form>       
<dtml-except MyException>
      <p class="warning"> Warn about problem found by external method.
      <form method=POST action="treatError"> <input type=submit value="OK"> </form>
<dtml-var standard_html_footer>

and it works wonderfully, to be honest I thought it was quite uncanny to define
and raise an exception inside the python module, and having it caught by the
DTML document.

Now, to improve the treatment of errors I need to refer, inside the
<dtml-except> block, to some variables that were defined in the REQUEST
variable (I'm pretty confident of this  because I used them inside the external
method), but it seems that the original REQUEST variable is no longer set
inside the <dtml-except> block.  Is this correct? What actually happens (in
simple terms, please :) when an exception is thrown?

I also tried the very few other tricks I know with DTML (<dtml-with
"_.namespace..."> outside the <dtml-try> block, plus some other voodoo) but
couldn't get it to work, either.

Should I return these values as error values with the exception?  I can do it
if this is the only option, but I'm already using the return value for
information related to external method things, and I'd rather not mix the two
``domains'', so to speak.

Many thanks for any tips,

Ramiro Brito Willmersdorf            rbw@demec.ufpe.br  
GPG key: http://www.demec.ufpe.br/~rbw/GPG/gpg_key.txt