[schema sync] if something went wrong while getting rdef in precommit event, rdef adttribute won't be set in revertprecommit. We don't want to fail in such case stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 21 Jul 2010 12:41:14 +0200
branchstable
changeset 6002 0ce7052ce30b
parent 6001 1a21d7d2c959
child 6003 5fbc1c4c13ff
[schema sync] if something went wrong while getting rdef in precommit event, rdef adttribute won't be set in revertprecommit. We don't want to fail in such case
hooks/syncschema.py
--- a/hooks/syncschema.py	Wed Jul 21 12:40:17 2010 +0200
+++ b/hooks/syncschema.py	Wed Jul 21 12:41:14 2010 +0200
@@ -580,7 +580,7 @@
 class RDefUpdateOp(MemSchemaOperation):
     """actually update some properties of a relation definition"""
     rschema = rdefkey = values = None # make pylint happy
-    oldvalues = None
+    rdef = oldvalues = None
     indexed_changed = null_allowed_changed = False
 
     def precommit_event(self):
@@ -604,6 +604,8 @@
                                UpdateFTIndexOp)
 
     def revertprecommit_event(self):
+        if self.rdef is None:
+            return
         # revert changes on in memory schema
         self.rdef.update(self.oldvalues)
         # revert changes on database