[Zope] dtml-try question (quickie)

Martijn Pieters Martijn Pieters <mj@digicool.com>
Fri, 17 Dec 1999 14:25:18 +0100


Hello Sam,

Friday, December 17, 1999, 2:03:30 AM, you wrote:
SG> Didn't I see some comments somewhere that the dtml-try tag now includes
SG> something like a dtml-else tag, so that we can have code that executes only if
SG> an exception is NOT thrown.  Does someone know the syntax for this if it exists?

I wrote the patch for it. It's in Zope since 2.1.0b2. It basically
brings the dtml-try tag up to par with the python try statement.

You can do:

  <dtml-try>
    Tricky code here.
  <dtml-except>
    Exception handler here.
  <dtml-else>
    No exception occurred, rejoice.
  </dtml-try>

And you can also use finally:

  <dtml-try>
    Tricky code here.
  <dtml-finally>
    Cleanup. Always called, but you can't display anything, because an
    exception occurred.
  </dtml-try>
  

-- 
Best regards,
 Martijn Pieters                    mailto:mj@digicool.com