----- Original Message ----- From: "Tino Wildenhain" <[EMAIL PROTECTED]>
To: "Jonathan" <[EMAIL PROTECTED]>; <zope@zope.org>
Sent: Thursday, December 15, 2005 8:48 AM
Subject: Re: [Zope] Trapping zope exceptions in python script


...

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)


Interesting work-around, but I agree that these exception types should be immediately available in plain vanilla python scripts.

Jonathan

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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