From 6a84d4856426c4537ece5474d48a846736c4e06a Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 10 Sep 2015 16:07:29 -0500 Subject: [PATCH] Remove is_authenticated property (excl. Tornado) --- raven/contrib/django/client.py | 3 +-- raven/contrib/zope/__init__.py | 9 +++++---- tests/contrib/django/tests.py | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/raven/contrib/django/client.py b/raven/contrib/django/client.py index 8ee88df1..9dbb82dd 100644 --- a/raven/contrib/django/client.py +++ b/raven/contrib/django/client.py @@ -35,11 +35,10 @@ class DjangoClient(Client): def get_user_info(self, user): if not user.is_authenticated(): - return {'is_authenticated': False} + return {} user_info = { 'id': user.pk, - 'is_authenticated': True, } if hasattr(user, 'email'): diff --git a/raven/contrib/zope/__init__.py b/raven/contrib/zope/__init__.py index 02af422e..4550ece6 100644 --- a/raven/contrib/zope/__init__.py +++ b/raven/contrib/zope/__init__.py @@ -96,11 +96,12 @@ class ZopeSentryHandler(SentryHandler): setattr(record, 'request', http) user = request.get('AUTHENTICATED_USER', None) if user is not None and user != nobody: - user_dict = dict(id=user.getId(), - is_authenticated=True, - email=user.getProperty('email') or '') + user_dict = { + 'id': user.getId(), + 'email': user.getProperty('email') or '', + } else: - user_dict = {'is_authenticated': False} + user_dict = {} setattr(record, 'user', user_dict) except (AttributeError, KeyError): logger.warning('Could not extract data from request', exc_info=True) diff --git a/tests/contrib/django/tests.py b/tests/contrib/django/tests.py index 98a93cd8..de4b8669 100644 --- a/tests/contrib/django/tests.py +++ b/tests/contrib/django/tests.py @@ -193,7 +193,6 @@ class DjangoClientTest(TestCase): assert 'user' in event user_info = event['user'] assert user_info == { - 'is_authenticated': True, 'username': user.username, 'id': user.id, 'email': user.email, @@ -217,7 +216,6 @@ class DjangoClientTest(TestCase): ) user_info = self.raven.get_user_info(user) assert user_info == { - 'is_authenticated': True, 'username': user.username, 'id': user.id, 'email': user.email,