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)
----- Original Message ----- From: "Tino Wildenhain" <tino@wildenhain.de> To: "Jonathan" <dev101@magma.ca>; <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
--On 15. Dezember 2005 09:08:20 -0500 Jonathan <dev101@magma.ca> wrote:
----- Original Message ----- From: "Tino Wildenhain" <tino@wildenhain.de> Interesting work-around, but I agree that these exception types should be immediately available in plain vanilla python scripts.
Patches + tests are welcome :-) -aj
Andreas Jung schrieb:
--On 15. Dezember 2005 09:08:20 -0500 Jonathan <dev101@magma.ca> wrote:
----- Original Message ----- From: "Tino Wildenhain" <tino@wildenhain.de> Interesting work-around, but I agree that these exception types should be immediately available in plain vanilla python scripts.
Patches + tests are welcome :-)
Yes, Jonathan: please file a bug report - best with a list of Exceptions to be made available :-) ++Tino
----- Original Message ----- From: "Tino Wildenhain" <tino@wildenhain.de> To: "Andreas Jung" <lists@andreas-jung.com> Cc: "Jonathan" <dev101@magma.ca>; <zope@zope.org> Sent: Thursday, December 15, 2005 9:15 AM Subject: Re: [Zope] Trapping zope exceptions in python script
Andreas Jung schrieb:
--On 15. Dezember 2005 09:08:20 -0500 Jonathan <dev101@magma.ca> wrote:
----- Original Message ----- From: "Tino Wildenhain" <tino@wildenhain.de> Interesting work-around, but I agree that these exception types should be immediately available in plain vanilla python scripts.
Patches + tests are welcome :-)
Yes, Jonathan: please file a bug report - best with a list of Exceptions to be made available :-)
++Tino
I'll see if I can come up with a patch and test... if sucessful I'll submit it! Jonathan
participants (3)
-
Andreas Jung -
Jonathan -
Tino Wildenhain