diff --git a/rhodecode/events/base.py b/rhodecode/events/base.py --- a/rhodecode/events/base.py +++ b/rhodecode/events/base.py @@ -15,6 +15,7 @@ # This program is dual-licensed. If you wish to learn more about the # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +import logging from datetime import datetime from pyramid.threadlocal import get_current_request @@ -26,6 +27,8 @@ SYSTEM_USER = AttributeDict(dict( username='__SYSTEM__' )) +log = logging.getLogger(__name__) + class RhodecodeEvent(object): """ @@ -66,10 +69,16 @@ class RhodecodeEvent(object): @property def server_url(self): + default = '' if self.request: from rhodecode.lib import helpers as h - return h.url('home', qualified=True) - return '' + try: + return h.url('home', qualified=True) + except Exception: + log.exception('Failed to fetch URL for server') + return default + + return default def as_dict(self): data = { diff --git a/rhodecode/events/pullrequest.py b/rhodecode/events/pullrequest.py --- a/rhodecode/events/pullrequest.py +++ b/rhodecode/events/pullrequest.py @@ -16,11 +16,14 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +import logging from rhodecode.translation import lazy_ugettext from rhodecode.events.repo import ( RepoEvent, _commits_as_dict, _issues_as_dict) +log = logging.getLogger(__name__) + class PullRequestEvent(RepoEvent): """ diff --git a/rhodecode/events/user.py b/rhodecode/events/user.py --- a/rhodecode/events/user.py +++ b/rhodecode/events/user.py @@ -15,6 +15,7 @@ # This program is dual-licensed. If you wish to learn more about the # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +import logging from zope.interface import implementer @@ -23,6 +24,8 @@ from rhodecode.events.base import Rhodec from rhodecode.events.interfaces import ( IUserRegistered, IUserPreCreate, IUserPreUpdate) +log = logging.getLogger(__name__) + @implementer(IUserRegistered) class UserRegistered(RhodecodeEvent):