Fixed missign user behavior in Django to be in line of what we did earlier.

This commit is contained in:
Armin Ronacher 2016-01-21 11:03:34 -08:00
parent 5e651b207a
commit bb2cd9fc15
1 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class DjangoClient(Client):
def get_user_info(self, user):
if hasattr(user, 'is_authenticated') and \
not user.is_authenticated():
return {}
return None
user_info = {
'id': user.pk,
@ -57,7 +57,9 @@ class DjangoClient(Client):
user = getattr(request, 'user', None)
if user is not None:
result['user'] = self.get_user_info(user)
user_info = self.get_user_info(user)
if user_info:
result['user'] = user_info
try:
uri = request.build_absolute_uri()