Show a Custom Error Message

This recipe shows how to handle Zope errors.

This script for "standard_error_message" should be located in the parent folder of your ZMS content object.</>

Features

  • if an URL containing dashes, '-', the RESPONSE is redirected to an URL with underscores '_'. Status code is set to 301: moved permanently.
  • otherwise a message is displayed recommending the parent URL.
  • in any other case it shows the header and footer in the context of the ZMS content object
  • the error traceback is "hidden" in a non-visible DIV

Remarks

This standard_html_header method only works if the entire DTML code is placed within a try/except block. This seems to be a new 'feature' in current Zope Versions. This script was tested on Zope 2.9.2