##// END OF EJS Templates
events: make the System URL extraction safer....
marcink -
r1424:5c92e9f4 default
parent child Browse files
Show More
@@ -15,6 +15,7 b''
15 15 # This program is dual-licensed. If you wish to learn more about the
16 16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 import logging
18 19
19 20 from datetime import datetime
20 21 from pyramid.threadlocal import get_current_request
@@ -26,6 +27,8 b' SYSTEM_USER = AttributeDict(dict('
26 27 username='__SYSTEM__'
27 28 ))
28 29
30 log = logging.getLogger(__name__)
31
29 32
30 33 class RhodecodeEvent(object):
31 34 """
@@ -66,10 +69,16 b' class RhodecodeEvent(object):'
66 69
67 70 @property
68 71 def server_url(self):
72 default = '<no server_url available>'
69 73 if self.request:
70 74 from rhodecode.lib import helpers as h
75 try:
71 76 return h.url('home', qualified=True)
72 return '<no server_url available>'
77 except Exception:
78 log.exception('Failed to fetch URL for server')
79 return default
80
81 return default
73 82
74 83 def as_dict(self):
75 84 data = {
@@ -16,11 +16,14 b''
16 16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 18
19 import logging
19 20
20 21 from rhodecode.translation import lazy_ugettext
21 22 from rhodecode.events.repo import (
22 23 RepoEvent, _commits_as_dict, _issues_as_dict)
23 24
25 log = logging.getLogger(__name__)
26
24 27
25 28 class PullRequestEvent(RepoEvent):
26 29 """
@@ -15,6 +15,7 b''
15 15 # This program is dual-licensed. If you wish to learn more about the
16 16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 import logging
18 19
19 20 from zope.interface import implementer
20 21
@@ -23,6 +24,8 b' from rhodecode.events.base import Rhodec'
23 24 from rhodecode.events.interfaces import (
24 25 IUserRegistered, IUserPreCreate, IUserPreUpdate)
25 26
27 log = logging.getLogger(__name__)
28
26 29
27 30 @implementer(IUserRegistered)
28 31 class UserRegistered(RhodecodeEvent):
General Comments 0
You need to be logged in to leave comments. Login now