summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Brownlees <kieran@mootium.co>2015-12-18 09:48:54 +1300
committerKieran Brownlees <kieran@mootium.co>2015-12-18 09:48:54 +1300
commit18579dd596fdff42ce385ccfbb7eb4832fc9f63c (patch)
tree4f283f605473ab83d5461fedf912123d9cd4607b
parentf39b68f3f754acfc06ac8ebf41cb23eb26b4b550 (diff)
downloadraven-18579dd596fdff42ce385ccfbb7eb4832fc9f63c.tar.gz
Store user information if AbstractBaseUser doesn't exist
The previous fix had the side effect of stopping user information being stored when AbstractBaseUser doesn't exist since the else clause would never be executed. Actually fixes #705
-rw-r--r--raven/contrib/django/client.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/raven/contrib/django/client.py b/raven/contrib/django/client.py
index 3e90258..ffb03e5 100644
--- a/raven/contrib/django/client.py
+++ b/raven/contrib/django/client.py
@@ -52,8 +52,6 @@ class DjangoClient(Client):
return user_info
def get_data_from_request(self, request):
- result = {}
-
try:
from django.contrib.auth.models import AbstractBaseUser as BaseUser
except ImportError:
@@ -61,10 +59,12 @@ class DjangoClient(Client):
except RuntimeError:
# If the contenttype / user applications are not installed trying to
# import the user models will fail for django >= 1.9.
- pass
- else:
- if hasattr(request, 'user') and isinstance(request.user, BaseUser):
- result['user'] = self.get_user_info(request.user)
+ BaseUser = None
+
+ result = {}
+
+ if BaseUser and hasattr(request, 'user') and isinstance(request.user, BaseUser):
+ result['user'] = self.get_user_info(request.user)
try:
uri = request.build_absolute_uri()