Show More
@@ -31,6 +31,8 b' class RhodecodeEvent(object):' | |||||
31 | """ |
|
31 | """ | |
32 | Base event class for all Rhodecode events |
|
32 | Base event class for all Rhodecode events | |
33 | """ |
|
33 | """ | |
|
34 | name = "RhodeCodeEvent" | |||
|
35 | ||||
34 | def __init__(self): |
|
36 | def __init__(self): | |
35 | self.request = get_current_request() |
|
37 | self.request = get_current_request() | |
36 | self.utc_timestamp = datetime.utcnow() |
|
38 | self.utc_timestamp = datetime.utcnow() | |
@@ -47,6 +49,13 b' class RhodecodeEvent(object):' | |||||
47 | return self.request.user.ip_addr |
|
49 | return self.request.user.ip_addr | |
48 | return '<no ip available>' |
|
50 | return '<no ip available>' | |
49 |
|
51 | |||
|
52 | @property | |||
|
53 | def server_url(self): | |||
|
54 | if self.request: | |||
|
55 | from rhodecode.lib import helpers as h | |||
|
56 | return h.url('home', qualified=True) | |||
|
57 | return '<no server_url available>' | |||
|
58 | ||||
50 | def as_dict(self): |
|
59 | def as_dict(self): | |
51 | data = { |
|
60 | data = { | |
52 | 'name': self.name, |
|
61 | 'name': self.name, | |
@@ -54,6 +63,7 b' class RhodecodeEvent(object):' | |||||
54 | 'actor_ip': self.actor_ip, |
|
63 | 'actor_ip': self.actor_ip, | |
55 | 'actor': { |
|
64 | 'actor': { | |
56 | 'username': self.actor.username |
|
65 | 'username': self.actor.username | |
57 | } |
|
66 | }, | |
|
67 | 'server_url': self.server_url | |||
58 | } |
|
68 | } | |
59 | return data No newline at end of file |
|
69 | return data |
@@ -183,6 +183,11 b' class RepoVCSEvent(RepoEvent):' | |||||
183 | if self.extras.get('ip'): |
|
183 | if self.extras.get('ip'): | |
184 | return self.extras['ip'] |
|
184 | return self.extras['ip'] | |
185 |
|
185 | |||
|
186 | @property | |||
|
187 | def server_url(self): | |||
|
188 | if self.extras.get('server_url'): | |||
|
189 | return self.extras['server_url'] | |||
|
190 | ||||
186 |
|
191 | |||
187 | class RepoPrePullEvent(RepoVCSEvent): |
|
192 | class RepoPrePullEvent(RepoVCSEvent): | |
188 | """ |
|
193 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now