Browse Source

[MIG] sentry to V11

- [FIX] sentry: fixes missing `raven` library preventing loading of modules
- [FIX] 2to3 script on py file
- [FIX] add requirements.txt
pull/1463/head
Naglis Jonaitis 8 years ago
committed by Sylvain LE GAL
parent
commit
3f24822d32
  1. 6
      sentry/__init__.py
  2. 3
      sentry/__manifest__.py
  3. 6
      sentry/logutils.py
  4. 4
      sentry/tests/test_client.py

6
sentry/__init__.py

@ -10,6 +10,8 @@ from odoo.tools import config as odoo_config
from . import const
from .logutils import LoggerNameFilter, OdooSentryHandler
import collections
_logger = logging.getLogger(__name__)
HAS_RAVEN = True
try:
@ -28,7 +30,7 @@ def get_odoo_commit(odoo_dir):
return raven.fetch_git_sha(odoo_dir)
except raven.exceptions.InvalidGitRepository:
_logger.debug(
u'Odoo directory: "%s" not a valid git repository', odoo_dir)
'Odoo directory: "%s" not a valid git repository', odoo_dir)
def initialize_raven(config, client_cls=None):
@ -46,7 +48,7 @@ def initialize_raven(config, client_cls=None):
}
for option in const.get_sentry_options():
value = config.get('sentry_%s' % option.key, option.default)
if callable(option.converter):
if isinstance(option.converter, collections.Callable):
value = option.converter(value)
options[option.key] = value

3
sentry/__manifest__.py

@ -4,11 +4,12 @@
{
'name': 'Sentry',
'summary': 'Report Odoo errors to Sentry',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Extra Tools',
'website': 'https://odoo-community.org/',
'author': 'Mohammed Barsi,'
'Versada,'
'Nicolas JEUDY,'
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,

6
sentry/logutils.py

@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
import urlparse
import urllib.parse
import odoo.http
@ -24,7 +24,7 @@ def get_request_info(request):
Heavily based on flask integration for Sentry: https://git.io/vP4i9.
'''
urlparts = urlparse.urlsplit(request.url)
urlparts = urllib.parse.urlsplit(request.url)
return {
'url': '%s://%s%s' % (urlparts.scheme, urlparts.netloc, urlparts.path),
'query_string': urlparts.query,
@ -101,6 +101,6 @@ class SanitizeOdooCookiesProcessor(SanitizePasswordsProcessor):
Allows to sanitize sensitive Odoo cookies, namely the "session_id" cookie.
'''
FIELDS = frozenset([
KEYS = frozenset([
'session_id',
])

4
sentry/tests/test_client.py

@ -74,13 +74,13 @@ class TestClientSetup(unittest.TestCase):
def assertEventCaptured(self, client, event_level, event_msg):
self.assertTrue(
client.has_event(event_level, event_msg),
msg=u'Event: "%s" was not captured' % event_msg
msg='Event: "%s" was not captured' % event_msg
)
def assertEventNotCaptured(self, client, event_level, event_msg):
self.assertFalse(
client.has_event(event_level, event_msg),
msg=u'Event: "%s" was captured' % event_msg
msg='Event: "%s" was captured' % event_msg
)
def test_initialize_raven_sets_dsn(self):

Loading…
Cancel
Save