equal
deleted
inserted
replaced
20 """ |
20 """ |
21 __docformat__ = "restructuredtext en" |
21 __docformat__ = "restructuredtext en" |
22 |
22 |
23 from logilab.common.textutils import normalize_text |
23 from logilab.common.textutils import normalize_text |
24 |
24 |
25 from cubicweb.selectors import implements |
25 from cubicweb.selectors import is_instance |
26 from cubicweb.server import hook |
26 from cubicweb.server import hook |
27 from cubicweb.sobjects.supervising import SupervisionMailOp |
27 from cubicweb.sobjects.supervising import SupervisionMailOp |
28 |
28 |
29 class RenderAndSendNotificationView(hook.Operation): |
29 class RenderAndSendNotificationView(hook.Operation): |
30 """delay rendering of notification view until precommit""" |
30 """delay rendering of notification view until precommit""" |
47 |
47 |
48 |
48 |
49 class StatusChangeHook(NotificationHook): |
49 class StatusChangeHook(NotificationHook): |
50 """notify when a workflowable entity has its state modified""" |
50 """notify when a workflowable entity has its state modified""" |
51 __regid__ = 'notifystatuschange' |
51 __regid__ = 'notifystatuschange' |
52 __select__ = NotificationHook.__select__ & implements('TrInfo') |
52 __select__ = NotificationHook.__select__ & is_instance('TrInfo') |
53 events = ('after_add_entity',) |
53 events = ('after_add_entity',) |
54 |
54 |
55 def __call__(self): |
55 def __call__(self): |
56 entity = self.entity |
56 entity = self.entity |
57 if not entity.from_state: # not a transition |
57 if not entity.from_state: # not a transition |