[migration] fix bug in `CWAttributeAddOp.revertprecommit_event` oldstable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 28 Mar 2013 11:45:17 +0100
brancholdstable
changeset 8818 d8b0984c923c
parent 8746 88c71ad83d47
child 8820 dbffb6959564
[migration] fix bug in `CWAttributeAddOp.revertprecommit_event` The `rdefdef` attribute is set during the operation execution. In some the operation crash before this assignment. In such case `revertprecommit` raise an attribute error crashing the whole process and shadowing the original error. This changeset detect and Avoid this situation.
hooks/syncschema.py
--- a/hooks/syncschema.py	Thu Mar 21 18:13:31 2013 +0100
+++ b/hooks/syncschema.py	Thu Mar 28 11:45:17 2013 +0100
@@ -507,6 +507,8 @@
 
     def revertprecommit_event(self):
         # revert changes on in memory schema
+        if getattr(self, 'rdefdef', None) is None:
+            return
         self.session.vreg.schema.del_relation_def(
             self.rdefdef.subject, self.rdefdef.name, self.rdefdef.object)
         # XXX revert changes on database