# HG changeset patch # User Sylvain Thénault # Date 1253693958 -7200 # Node ID a35c6ae5bef2b4e7b68b6dedde13fdd1cd88b4b1 # Parent fb261afd49cdf5fc31e1e2cac88e48a832309a5b update hook api diff -r fb261afd49cd -r a35c6ae5bef2 server/test/data/hooks.py --- a/server/test/data/hooks.py Wed Sep 23 09:54:25 2009 +0200 +++ b/server/test/data/hooks.py Wed Sep 23 10:19:18 2009 +0200 @@ -5,27 +5,31 @@ :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses """ -from cubicweb.server.hooksmanager import SystemHook +from cubicweb.server.hook import Hook CALLED_EVENTS = {} -class StartupHook(SystemHook): +class StartupHook(Hook): + __regid__ = 'mystartup' events = ('server_startup',) - def call(self, repo): + def __call__(self): CALLED_EVENTS['server_startup'] = True -class ShutdownHook(SystemHook): +class ShutdownHook(Hook): + __regid__ = 'myshutdown' events = ('server_shutdown',) - def call(self, repo): + def __call__(self): CALLED_EVENTS['server_shutdown'] = True -class LoginHook(SystemHook): +class LoginHook(Hook): + __regid__ = 'mylogin' events = ('session_open',) - def call(self, session): - CALLED_EVENTS['session_open'] = session.user.login + def __call__(self): + CALLED_EVENTS['session_open'] = self._cw.user.login -class LogoutHook(SystemHook): +class LogoutHook(Hook): + __regid__ = 'mylogout' events = ('session_close',) - def call(self, session): - CALLED_EVENTS['session_close'] = session.user.login + def __call__(self): + CALLED_EVENTS['session_close'] = self._cw.user.login