Permalink
Browse files

Fix creating an experiment user without a request

  • Loading branch information...
1 parent a40e9b9 commit 4754fa20a12af32cd90c5ffe11408771810df1a9 @theospears theospears committed Nov 13, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 experiments/utils.py
@@ -23,17 +23,17 @@ def _record_goal(goal_name, request=None, session=None, user=None):
def create_user(request=None, session=None, user=None):
- if request and not user:
+ if request and hasattr(request, 'user') and not user:
user = request.user
- if request and not session:
+ if request and hasattr(request, 'session') and not session:
session = request.session
if request and BOT_REGEX.search(request.META.get("HTTP_USER_AGENT","")):
return DummyUser()
elif user and user.is_authenticated():
- return AuthenticatedUser(request.user)
+ return AuthenticatedUser(user)
elif session:
- return SessionUser(request.session)
+ return SessionUser(session)
else:
return DummyUser()

0 comments on commit 4754fa2

Please sign in to comment.