[Zope] Trapping zope exceptions in python script

Tino Wildenhain tino at wildenhain.de
Thu Dec 15 08:48:37 EST 2005


...
> 
> Try:
> 
> context.afolder.manage_delObjects(['someitem'])
> 
> where 'someitem' does not exist in 'afolder'

works:

try:
    context.afolder.manage_adlObjects(['nonexistent'])
except Exception,x:
    if 'BadRequest' in repr(x):
       print "bad request"
    else:
       raise x

:-)

(Ok, this _is_ ugly, but at least works. Certainly these
exception types should be importable or even immediately
available for python scripts)





More information about the Zope mailing list