hooks/integrity.py
branchstable
changeset 6838 6c7adf825b3c
parent 6426 541659c39f6a
child 6889 37668bf302f5
equal deleted inserted replaced
6837:7562418985ef 6838:6c7adf825b3c
    77 
    77 
    78     def precommit_event(self):
    78     def precommit_event(self):
    79         session = self.session
    79         session = self.session
    80         pendingeids = session.transaction_data.get('pendingeids', ())
    80         pendingeids = session.transaction_data.get('pendingeids', ())
    81         pendingrtypes = session.transaction_data.get('pendingrtypes', ())
    81         pendingrtypes = session.transaction_data.get('pendingrtypes', ())
    82         # poping key is not optional: if further operation trigger new deletion
       
    83         # of relation, we'll need a new operation
       
    84         for eid, rtype in self.get_data():
    82         for eid, rtype in self.get_data():
    85             # recheck pending eids / relation types
    83             # recheck pending eids / relation types
    86             if eid in pendingeids:
    84             if eid in pendingeids:
    87                 continue
    85                 continue
    88             if rtype in pendingrtypes:
    86             if rtype in pendingrtypes:
   299 
   297 
   300     def precommit_event(self):
   298     def precommit_event(self):
   301         session = self.session
   299         session = self.session
   302         pendingeids = session.transaction_data.get('pendingeids', ())
   300         pendingeids = session.transaction_data.get('pendingeids', ())
   303         neweids = session.transaction_data.get('neweids', ())
   301         neweids = session.transaction_data.get('neweids', ())
   304         # poping key is not optional: if further operation trigger new deletion
       
   305         # of composite relation, we'll need a new operation
       
   306         for eid, rtype in self.get_data():
   302         for eid, rtype in self.get_data():
   307             # don't do anything if the entity is being created or deleted
   303             # don't do anything if the entity is being created or deleted
   308             if not (eid in pendingeids or eid in neweids):
   304             if not (eid in pendingeids or eid in neweids):
   309                 etype = session.describe(eid)[0]
   305                 etype = session.describe(eid)[0]
   310                 session.execute(self.base_rql % (etype, rtype), {'x': eid})
   306                 session.execute(self.base_rql % (etype, rtype), {'x': eid})