##// END OF EJS Templates
events: expose server_url for repo events.
marcink -
r649:724715f1 default
parent child Browse files
Show More
@@ -31,6 +31,8 b' class RhodecodeEvent(object):'
31 31 """
32 32 Base event class for all Rhodecode events
33 33 """
34 name = "RhodeCodeEvent"
35
34 36 def __init__(self):
35 37 self.request = get_current_request()
36 38 self.utc_timestamp = datetime.utcnow()
@@ -47,6 +49,13 b' class RhodecodeEvent(object):'
47 49 return self.request.user.ip_addr
48 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 59 def as_dict(self):
51 60 data = {
52 61 'name': self.name,
@@ -54,6 +63,7 b' class RhodecodeEvent(object):'
54 63 'actor_ip': self.actor_ip,
55 64 'actor': {
56 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 183 if self.extras.get('ip'):
184 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 192 class RepoPrePullEvent(RepoVCSEvent):
188 193 """
General Comments 0
You need to be logged in to leave comments. Login now