raise: Raises an exception

The raise tag raises an exception, mirroring the Python raise statement.

Syntax

raise tag syntax:

      <dtml-raise ExceptionName|ExceptionExpression>
      </dtml-raise>

The raise tag is a block tag. It raises an exception. Exceptions can be an exception class or a string. The contents of the tag are passed as the error value.

Examples

Raising a KeyError:

      <dtml-raise KeyError></dtml-raise>

Raising an HTTP 404 error:

      <dtml-raise NotFound>Web Page Not Found</dtml-raise>

See Also

try tag

Python Tutorial: Errors and Exceptions

Python Built-in Exceptions