[Zope] Re: Exceptions and Python Scripts

Fred Yankowski fred@ontosys.com
Wed, 21 Feb 2001 09:35:29 -0600


I faced this exact problem -- catching specific Zope exceptions and
re-raising others -- and that necessary sys.exc_info() route of doing
that is pretty ugly.  Is there a plan for moving to class-based
exceptions, or would that break too much code that assumes the current
string exceptions?

In my experience, Python Scripts, because of their security-related
limitations, are capable of only trivial functionality that isn't that
much harder to do in DTML.  I'd prefer to do most all Zope development
in unfettered Python and some clean templating system -- and the
recently published roadmap doc suggests that this may be possible
later -- but the current TTW-editing architecture makes this hard to
do.  Both External Methods and Products require hacking directly on
source files, although I suppose some hack with LocalFS could make
those files accessible TTW.

On Wed, Feb 21, 2001 at 03:10:26PM +0000, Chris Withers wrote:
> Okay, the real problem is twofold:
> 
> 1. Zope is littered with string exceptions
> 2. Catching exceptions that you didn't mean to is a Real Bad Thing (tm)
> 
> Put these two together and and you need to use sys.exc_info() to analyse the
> type and value to decide whether you should re-raise it or not.

-- 
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA