raise: Raises an exception

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


raise tag syntax:

      <dtml-raise ExceptionName|ExceptionExpression>

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.


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