server/hooks.py
changeset 2607 5d889b4928bb
parent 2606 598ac51cac04
child 2695 56439c45781c
equal deleted inserted replaced
2606:598ac51cac04 2607:5d889b4928bb
   166     has actually been redirected to another composite
   166     has actually been redirected to another composite
   167     """
   167     """
   168 
   168 
   169     def precommit_event(self):
   169     def precommit_event(self):
   170         session = self.session
   170         session = self.session
   171         if not self.eid in session.transaction_data.get('pendingeids', ()):
   171         # don't do anything if the entity is being created or deleted
       
   172         if not (self.eid in session.transaction_data.get('pendingeids', ()) or
       
   173                 self.eid in session.transaction_data.get('neweids', ())):
   172             etype = session.describe(self.eid)[0]
   174             etype = session.describe(self.eid)[0]
   173             session.unsafe_execute('DELETE %s X WHERE X eid %%(x)s, NOT %s'
   175             session.unsafe_execute('DELETE %s X WHERE X eid %%(x)s, NOT %s'
   174                                    % (etype, self.relation),
   176                                    % (etype, self.relation),
   175                                    {'x': self.eid}, 'x')
   177                                    {'x': self.eid}, 'x')
   176 
   178