[hooks/...] fix previous commit stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 30 Apr 2010 18:24:29 +0200
branchstable
changeset 5449 a7e1b316af03
parent 5448 9bf648d678cd
child 5450 269dcd14b92c
[hooks/...] fix previous commit
hooks/integrity.py
hooks/metadata.py
hooks/security.py
--- a/hooks/integrity.py	Fri Apr 30 16:39:50 2010 +0200
+++ b/hooks/integrity.py	Fri Apr 30 18:24:29 2010 +0200
@@ -164,7 +164,7 @@
     """
     def precommit_event(self):
         session = self.session
-        for values in session.transaction_data['check_constraints_op']:
+        for values in session.transaction_data.pop('check_constraints_op'):
             eidfrom, rtype, eidto = values[:3]
             # first check related entities have not been deleted in the same
             # transaction
@@ -225,7 +225,7 @@
                 constraints = [c for c in eschema.rdef(attr).constraints
                                if isinstance(c, (RQLUniqueConstraint, RQLConstraint))]
                 if constraints:
-                    hook.set_operation(self._cw, 'check_constraint_op',
+                    hook.set_operation(self._cw, 'check_constraints_op',
                                        (self.entity.eid, attr, None) + tuple(constraints),
                                        _CheckConstraintsOp)
 
--- a/hooks/metadata.py	Fri Apr 30 16:39:50 2010 +0200
+++ b/hooks/metadata.py	Fri Apr 30 18:24:29 2010 +0200
@@ -69,7 +69,7 @@
 
     def precommit_event(self):
         session = self.session
-        for eid in session.transaction_data['set_creator_op']:
+        for eid in session.transaction_data.pop('set_creator_op'):
             if session.deleted_in_transaction(eid):
                 # entity have been created and deleted in the same transaction
                 continue
@@ -114,7 +114,7 @@
 
 class _SyncOwnersOp(hook.Operation):
     def precommit_event(self):
-        for compositeeid, composedeid in self.session.transaction_data['sync_owners_op']:
+        for compositeeid, composedeid in self.session.transaction_data.pop('sync_owners_op'):
             self.session.execute('SET X owned_by U WHERE C owned_by U, C eid %(c)s,'
                                  'NOT EXISTS(X owned_by U, X eid %(x)s)',
                                  {'c': compositeeid, 'x': composedeid})
--- a/hooks/security.py	Fri Apr 30 16:39:50 2010 +0200
+++ b/hooks/security.py	Fri Apr 30 18:24:29 2010 +0200
@@ -54,11 +54,11 @@
     def precommit_event(self):
         #print 'CheckEntityPermissionOp', self.session.user, self.entity, self.action
         session = self.session
-        for values in session.transaction_data['check_entity_perm_op']:
+        for values in session.transaction_data.pop('check_entity_perm_op'):
             entity = session.entity_from_eid(values[0])
             action = values[1]
-        entity.check_perm(action)
-        check_entity_attributes(session, entity, values[2:])
+            entity.check_perm(action)
+            check_entity_attributes(session, entity, values[2:])
 
     def commit_event(self):
         pass