Python 3 compatibility (refs GH-659)

This commit is contained in:
David Cramer 2015-09-16 14:55:53 -07:00
parent 97ad85d594
commit 3e5ae0c9bf
3 changed files with 5 additions and 4 deletions

View File

@ -29,6 +29,7 @@ from raven.middleware import Sentry as SentryMiddleware
from raven.handlers.logging import SentryHandler
from raven.utils import six
from raven.utils.compat import _urlparse
from raven.utils.encoding import to_unicode
from raven.utils.imports import import_string
from raven.utils.wsgi import get_headers, get_environ
@ -218,11 +219,11 @@ class Sentry(object):
try:
self.client.http_context(self.get_http_info(request))
except Exception as e:
self.client.logger.exception(unicode(e))
self.client.logger.exception(to_unicode(e))
try:
self.client.user_context(self.get_user_info(request))
except Exception as e:
self.client.logger.exception(unicode(e))
self.client.logger.exception(to_unicode(e))
def after_request(self, sender, response, *args, **kwargs):
if self.last_event_id:

View File

@ -213,7 +213,7 @@ def slim_frame_data(frames, frame_allowance=25):
half_max = frame_allowance / 2
for n in xrange(half_max, frames_len - half_max):
for n in range(half_max, frames_len - half_max):
# remove heavy components
frames[n].pop('vars', None)
frames[n].pop('pre_context', None)

View File

@ -65,7 +65,7 @@ class ZeroRPCTest(TestCase):
self._client.choice([])
for attempt in xrange(0, 10):
for attempt in range(0, 10):
gevent.sleep(0.1)
if len(self._sentry.events):
exc = self._sentry.events[0]['exception']