hooks/notification.py
changeset 10351 91e63306e277
parent 9632 c60c8dec0e0e
child 11084 ffd615e626f9
equal deleted inserted replaced
10350:31327bd26931 10351:91e63306e277
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
   163 
   163 
   164 
   164 
   165 class EntityUpdateHook(NotificationHook):
   165 class EntityUpdateHook(NotificationHook):
   166     __regid__ = 'notifentityupdated'
   166     __regid__ = 'notifentityupdated'
   167     __abstract__ = True # do not register by default
   167     __abstract__ = True # do not register by default
   168     __select__ = NotificationHook.__select__ & hook.from_dbapi_query()
   168     __select__ = NotificationHook.__select__ & hook.issued_from_user_query()
   169     events = ('before_update_entity',)
   169     events = ('before_update_entity',)
   170     skip_attrs = set()
   170     skip_attrs = set()
   171 
   171 
   172     def __call__(self):
   172     def __call__(self):
   173         cnx = self._cw
   173         cnx = self._cw
   198 
   198 
   199 # supervising ##################################################################
   199 # supervising ##################################################################
   200 
   200 
   201 class SomethingChangedHook(NotificationHook):
   201 class SomethingChangedHook(NotificationHook):
   202     __regid__ = 'supervising'
   202     __regid__ = 'supervising'
   203     __select__ = NotificationHook.__select__ & hook.from_dbapi_query()
   203     __select__ = NotificationHook.__select__ & hook.issued_from_user_query()
   204     events = ('before_add_relation', 'before_delete_relation',
   204     events = ('before_add_relation', 'before_delete_relation',
   205               'after_add_entity', 'before_update_entity')
   205               'after_add_entity', 'before_update_entity')
   206 
   206 
   207     def __call__(self):
   207     def __call__(self):
   208         dest = self._cw.vreg.config['supervising-addrs']
   208         dest = self._cw.vreg.config['supervising-addrs']