[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Advanced Page Templates

webmaster at zope.org webmaster at zope.org
Thu Feb 12 14:46:11 EST 2004

A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/AdvZPT.stx#3-28


      Any error that occurs inside the 'div' will call the
      'handleError' script. Note that the 'structure' option allows
      the script to return HTML. Your error handling script can
      examine the error and take various actions depending on the
      error. Your script gets access to the error through the 'error'
      variable in the namespace. For example::

        ## Script (Python) "handleError"
        ##bind namespace=_
        if error.type==ZeroDivisionError:
            return "<p>Can't divide by zero.</p>"
            return """<p>An error occurred.</p>
                      <p>Error type: %s</p>
                      <p>Error value: %s</p>""" % (error.type,

        % Anonymous User - Feb. 12, 2004 2:46 pm:
         Shouldn't there be a colon after the "else"?

More information about the ZDP mailing list