Home arrow Zope arrow Page 10 - Exception Handling In DTML

Endzone - Zope

Ever wondered if there was a way to stop Zope from barfing error messages all over your screen when one of your scripts crashes and burns? Well, guess what - there is! Meet the and tags, which can be used to trap and resolve errors in script execution.

  1. Exception Handling In DTML
  2. Anatomy Class
  3. Playing Catch
  4. Being Verbose
  5. All For One...
  6. ...And One For All
  7. The Final Solution
  8. Raising The Bar
  9. Pre-Packaged Python
  10. Endzone
By: Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 1
August 13, 2002

print this article


And that just about covers it. In this article, I took you on a guided tour of exception handling in DTML, demonstrating how the and blocks can be used to trap and resolve errors in script execution. I showed you how the statement could be used to handle different exceptions differently, or be set up to catch all errors in a generic manner.

I also explained a variant, the <dtml-finally> statement, and demonstrated how it could be nested within a set of <dtml-try> blocks to trigger specific code segments whenever an exception occurs. Finally, I showed you how to create your own custom exceptions via <dtml-raise>, and provided you with a quick look at some of the built-in exceptions that come with Zope.

In case you'd like to learn more about these topics, you should consider visiting the following links:

Exception handling in Zope, at http://www.zope.org/Documentation/ZopeBook/AdvDTML.stx

Reference material for the various exception handling tags, at http://www.zope.org/Documentation/ZopeBook/AppendixA.stx

A complete list of Python exceptions, at http://www.python.org/doc/current/lib/module-exceptions.html

Until next time...be good!

Note: All examples in this article have been tested on Linux/i586 with Zope 2.5.0. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!

>>> More Zope Articles          >>> More By Harish Kamath, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Creating Zope Products
- Plone Content Types With Archetypes
- Flat User Management in Zope
- Creating Basic Zope Applications
- Getting started with Zope for Linux and Sola...
- ZPT Basics (part 4)
- ZPT Basics (part 3)
- ZPT Basics (part 2)
- ZPT Basics (part 1)
- Exception Handling In DTML
- DTML Basics (part 4)
- DTML Basics (part 3)
- DTML Basics (part 2)
- DTML Basics (part 1)
- Using Zope With Apache

Developer Shed Affiliates


Dev Shed Tutorial Topics: