##// END OF EJS Templates
events: Add events for pre user create and pre user update....
johbo -
r227:8af8d224 default
parent child Browse files
Show More
@@ -17,7 +17,8 b''
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 from zope.interface import implementer
19 from zope.interface import implementer
20 from rhodecode.interfaces import IUserRegistered
20 from rhodecode.interfaces import (
21 IUserRegistered, IUserPreCreate, IUserPreUpdate)
21
22
22
23
23 @implementer(IUserRegistered)
24 @implementer(IUserRegistered)
@@ -29,3 +30,24 b' class UserRegistered(object):'
29 def __init__(self, user, session):
30 def __init__(self, user, session):
30 self.user = user
31 self.user = user
31 self.session = session
32 self.session = session
33
34
35 @implementer(IUserPreCreate)
36 class UserPreCreate(object):
37 """
38 An instance of this class is emitted as an :term:`event` before a new user
39 object is created.
40 """
41 def __init__(self, active):
42 self.active = active
43
44
45 @implementer(IUserPreUpdate)
46 class UserPreUpdate(object):
47 """
48 An instance of this class is emitted as an :term:`event` before a user
49 object is updated.
50 """
51 def __init__(self, user, active):
52 self.user = user
53 self.active = active
@@ -26,3 +26,18 b' class IUserRegistered(Interface):'
26 """
26 """
27 user = Attribute('The user object.')
27 user = Attribute('The user object.')
28 session = Attribute('The session while processing the register form post.')
28 session = Attribute('The session while processing the register form post.')
29
30
31 class IUserPreCreate(Interface):
32 """
33 An event type that is emitted before a new user object is persisted.
34 """
35 active = Attribute('Value for user.active')
36
37
38 class IUserPreUpdate(Interface):
39 """
40 An event type that is emitted before a user object is updated.
41 """
42 user = Attribute('The not yet updated user object')
43 active = Attribute('New value for user.active')
General Comments 0
You need to be logged in to leave comments. Login now