41 __select__ = hook.Hook.__select__ & hook.match_rtype('use_email') |
41 __select__ = hook.Hook.__select__ & hook.match_rtype('use_email') |
42 category = 'email' |
42 category = 'email' |
43 events = ('after_add_relation',) |
43 events = ('after_add_relation',) |
44 |
44 |
45 def __call__(self): |
45 def __call__(self): |
46 entity = self.cw_req.entity_from_eid(self.eidfrom) |
46 entity = self._cw.entity_from_eid(self.eidfrom) |
47 if 'primary_email' in entity.e_schema.subject_relations(): |
47 if 'primary_email' in entity.e_schema.subject_relations(): |
48 SetPrimaryEmailRelationOp(self.cw_req, entity=entity, |
48 SetPrimaryEmailRelationOp(self._cw, entity=entity, |
49 email=self.cw_req.entity_from_eid(self.eidto)) |
49 email=self._cw.entity_from_eid(self.eidto)) |
50 |
50 |
51 class SetUseEmailHook(hook.Hook): |
51 class SetUseEmailHook(hook.Hook): |
52 """notify when a bug or story or version has its state modified""" |
52 """notify when a bug or story or version has its state modified""" |
53 __id__ = 'setprimaryemail' |
53 __id__ = 'setprimaryemail' |
54 __select__ = hook.Hook.__select__ & hook.match_rtype('primary_email') |
54 __select__ = hook.Hook.__select__ & hook.match_rtype('primary_email') |
55 category = 'email' |
55 category = 'email' |
56 events = ('after_add_relation',) |
56 events = ('after_add_relation',) |
57 |
57 |
58 def __call__(self): |
58 def __call__(self): |
59 entity = self.cw_req.entity_from_eid(self.eidfrom) |
59 entity = self._cw.entity_from_eid(self.eidfrom) |
60 if 'use_email' in entity.e_schema.subject_relations(): |
60 if 'use_email' in entity.e_schema.subject_relations(): |
61 SetUseEmailRelationOp(self.cw_req, entity=entity, |
61 SetUseEmailRelationOp(self._cw, entity=entity, |
62 email=self.cw_req.entity_from_eid(self.eidto)) |
62 email=self._cw.entity_from_eid(self.eidto)) |