----- Original Message -----
From: "J Cameron Cooper" <[EMAIL PROTECTED]>
To: "Jonathan" <[EMAIL PROTECTED]>
Sent: Wednesday, December 14, 2005 4:33 PM
Subject: Re: [Zope] Trapping zope exceptions in python script
Thanks to everyone for the feedback... the bottom line seems to be that
you can NOT trap zope exceptions in a python script... which seems a bit
Of course you can. You just are restricted from importing certain things,
which happens to include this class of exception. Probably it is safe for
Zope to allow importing this in restricted code; feel free to file a bug
But you have easy avenues to deal with this: either declare that class
safe for import or take a couple extra seconds and write it in an External
Yes I know I can "force" python scripts to allow zExceptions, and yes I know
that I can write an external method, but that was not the question.
It seems strange that one can, using plain vanilla python scripts, trap
bare 'try/excepts' (and I agree with Andreas that this is not a good thing
to do!) and that one can trap python built-in exceptions, but that one
cannot trap zope exceptions. Why allow python scripts to trap zope
exceptions using a bare try/except (and then have to re-raise everything
except the target zope exception), but not allow python scripts to target
specific zope exceptions? I don't see the reasoning behind this approach.
I don't think this is a bug, it is more of a feature request and does
anybody else think it is reasonable/logical/useful?
Just curious is all.
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -