hooks/email.py
changeset 10187 0df931eb08de
parent 9990 c84ad981fc4a
parent 10184 c6dfa0d6b7d1
equal deleted inserted replaced
10177:7b95eae7669d 10187:0df931eb08de
    33         """check entity has use_email set for the email address"""
    33         """check entity has use_email set for the email address"""
    34         return not any(e for e in self.entity.use_email
    34         return not any(e for e in self.entity.use_email
    35                        if self.email.eid == e.eid)
    35                        if self.email.eid == e.eid)
    36 
    36 
    37     def precommit_event(self):
    37     def precommit_event(self):
       
    38         if self.cnx.deleted_in_transaction(self.entity.eid):
       
    39             return
       
    40         if self.cnx.deleted_in_transaction(self.email.eid):
       
    41             return
    38         if self.condition():
    42         if self.condition():
    39             self.cnx.execute(
    43             self.cnx.execute(
    40                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,
    44                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,
    41                 {'x': self.entity.eid, 'y': self.email.eid})
    45                 {'x': self.entity.eid, 'y': self.email.eid})
    42 
    46