[hooks] don't insert use_email relation if the entity on either side is going away
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 16 Jan 2015 17:48:16 +0100
changeset 10184 c6dfa0d6b7d1
parent 10183 ff93dad2ae3a
child 10185 b7c373d74754
[hooks] don't insert use_email relation if the entity on either side is going away Closes #4912946
hooks/email.py
--- a/hooks/email.py	Fri Jan 16 10:57:02 2015 +0100
+++ b/hooks/email.py	Fri Jan 16 17:48:16 2015 +0100
@@ -35,6 +35,10 @@
                        if self.email.eid == e.eid)
 
     def precommit_event(self):
+        if self.cnx.deleted_in_transaction(self.entity.eid):
+            return
+        if self.cnx.deleted_in_transaction(self.email.eid):
+            return
         if self.condition():
             self.cnx.execute(
                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,