hooks/email.py
changeset 3421 7fec79c1c11f
parent 3376 f5c69485381f
child 3431 6944a92c16f2
equal deleted inserted replaced
3420:15f17399bda2 3421:7fec79c1c11f
    25     def precommit_event(self):
    25     def precommit_event(self):
    26         if self.condition():
    26         if self.condition():
    27             # we've to handle cardinaly by ourselves since we're using unsafe_execute
    27             # we've to handle cardinaly by ourselves since we're using unsafe_execute
    28             # but use session.execute and not session.unsafe_execute to check we
    28             # but use session.execute and not session.unsafe_execute to check we
    29             # can change the relation
    29             # can change the relation
    30             ensure_card_respected(session.execute, session,
    30             ensure_card_respected(self.session.execute, self.session,
    31                                   self.fromeid, self.rtype, self.toeid)
    31                                   self.entity.eid, self.rtype, self.email.eid)
    32             session.unsafe_execute(
    32             self.session.unsafe_execute(
    33                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,
    33                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,
    34                 {'x': self.entity.eid, 'y': self.email.eid}, 'x')
    34                 {'x': self.entity.eid, 'y': self.email.eid}, 'x')
    35 
    35 
    36 class SetPrimaryEmailRelationOp(SetUseEmailRelationOp):
    36 class SetPrimaryEmailRelationOp(SetUseEmailRelationOp):
    37     rtype = 'primary_email'
    37     rtype = 'primary_email'