author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> |
Mon, 05 Apr 2010 09:06:16 +0200 | |
branch | stable |
changeset 5145 | bfa4d775219f |
parent 4252 | 6c4f109c2b03 |
child 5421 | 8167de96c523 |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
3 |
:organization: Logilab |
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
7 |
""" |
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
8 |
from cubicweb.server.hook import Hook |
0 | 9 |
|
10 |
CALLED_EVENTS = {} |
|
11 |
||
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
12 |
class StartupHook(Hook): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
13 |
__regid__ = 'mystartup' |
0 | 14 |
events = ('server_startup',) |
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
15 |
def __call__(self): |
0 | 16 |
CALLED_EVENTS['server_startup'] = True |
17 |
||
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
18 |
class ShutdownHook(Hook): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
19 |
__regid__ = 'myshutdown' |
0 | 20 |
events = ('server_shutdown',) |
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
21 |
def __call__(self): |
0 | 22 |
CALLED_EVENTS['server_shutdown'] = True |
23 |
||
24 |
||
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
25 |
class LoginHook(Hook): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
26 |
__regid__ = 'mylogin' |
0 | 27 |
events = ('session_open',) |
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
28 |
def __call__(self): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
29 |
CALLED_EVENTS['session_open'] = self._cw.user.login |
0 | 30 |
|
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
31 |
class LogoutHook(Hook): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
32 |
__regid__ = 'mylogout' |
0 | 33 |
events = ('session_close',) |
3397
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
34 |
def __call__(self): |
a35c6ae5bef2
update hook api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
35 |
CALLED_EVENTS['session_close'] = self._cw.user.login |