[F hooks] skip new eids as well as pending ones in DelayedDelete operation
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 31 Jul 2009 23:48:18 +0200
changeset 2607 5d889b4928bb
parent 2606 598ac51cac04
child 2608 21856eda34f6
[F hooks] skip new eids as well as pending ones in DelayedDelete operation
server/hooks.py
--- a/server/hooks.py	Fri Jul 31 23:47:20 2009 +0200
+++ b/server/hooks.py	Fri Jul 31 23:48:18 2009 +0200
@@ -168,7 +168,9 @@
 
     def precommit_event(self):
         session = self.session
-        if not self.eid in session.transaction_data.get('pendingeids', ()):
+        # don't do anything if the entity is being created or deleted
+        if not (self.eid in session.transaction_data.get('pendingeids', ()) or
+                self.eid in session.transaction_data.get('neweids', ())):
             etype = session.describe(self.eid)[0]
             session.unsafe_execute('DELETE %s X WHERE X eid %%(x)s, NOT %s'
                                    % (etype, self.relation),