Bare except and ConflictError in manage_beforeDelete
I have code that needs to maintain certain invariants when objects are deleted, these invariants are maintained in manage_beforeDelete. Unfortunately manage_beforeDelete has this code: try: if hasattr(aq_base(object), 'manage_beforeDelete'): object.manage_beforeDelete(item, container) except BeforeDeleteException, ob: raise except: LOG('Zope',ERROR,'manage_beforeDelete() threw', error=sys.exc_info()) pass Which means that ConflictErrors in my invariant code get swallowed, and my invariants are broken. This kills me. I want to add an additionnal: except ConflictError: raise Any objections ? Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
On Fri, Oct 31, 2003 at 12:28:45PM +0100, Florent Guillaume wrote: | I have code that needs to maintain certain invariants when objects are | deleted, these invariants are maintained in manage_beforeDelete. | | Unfortunately manage_beforeDelete has this code: | try: | if hasattr(aq_base(object), 'manage_beforeDelete'): | object.manage_beforeDelete(item, container) | except BeforeDeleteException, ob: | raise | except: | LOG('Zope',ERROR,'manage_beforeDelete() threw', | error=sys.exc_info()) | pass | Which means that ConflictErrors in my invariant code get swallowed, and | my invariants are broken. This kills me. | | I want to add an additionnal: | except ConflictError: | raise +1 from me. -- Sidnei da Silva <sidnei@awkly.org> dreamcatching :: making your dreams come true http://awkly.org My apologies if I sound angry. I feel like I'm talking to a void. -- Avery Pennarun
On Fri, 2003-10-31 at 09:28, Florent Guillaume wrote:
[...] manage_beforeDelete has this code: try: if hasattr(aq_base(object), 'manage_beforeDelete'): object.manage_beforeDelete(item, container) except BeforeDeleteException, ob: raise except: LOG('Zope',ERROR,'manage_beforeDelete() threw', error=sys.exc_info()) pass Which means that ConflictErrors in my invariant code get swallowed [...]
I want to add an additionnal: except ConflictError: raise
+1 -- Ideas don't stay in some minds very long because they don't like solitary confinement.
+1 On Fri, 2003-10-31 at 07:43, Leonardo Rochael Almeida wrote:
On Fri, 2003-10-31 at 09:28, Florent Guillaume wrote:
[...] manage_beforeDelete has this code: try: if hasattr(aq_base(object), 'manage_beforeDelete'): object.manage_beforeDelete(item, container) except BeforeDeleteException, ob: raise except: LOG('Zope',ERROR,'manage_beforeDelete() threw', error=sys.exc_info()) pass Which means that ConflictErrors in my invariant code get swallowed [...]
I want to add an additionnal: except ConflictError: raise
+1
I wrote:
I have code that needs to maintain certain invariants when objects are deleted, these invariants are maintained in manage_beforeDelete. [...] I want to add an additionnal: except ConflictError: raise
Ok, this has been checked in on HEAD, Zope-2_7-branch and Zope-2_6-branch. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
participants (4)
-
Chris McDonough -
Florent Guillaume -
Leonardo Rochael Almeida -
Sidnei da Silva