Hi list:

In Script(python) binding page. there is some description about namespace binding:

When the script is called from DTML, this is the caller's DTML namespace, otherwise it is an empty namespace.

Recommended value: |_| (underscore character)

But in zope book, when talk about Error Handling in the Advanced Page Templates chapter. It looks that it use ZPT with script's namespace. See below.

For more flexible error handling you can call a script. For example:

<div tal:on-error="structure here/handleError">

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,

So what happened with namespace when calling Script from ZPT?

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to