We need to check for AnonymousUser here sine that's what Django Request Framework will return when no authentication is provided

This commit is contained in:
Matthew Jones 2013-11-20 01:29:50 -05:00
parent 0127680805
commit 6f652d801a

View File

@ -1,5 +1,5 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User, AnonymousUser
from django.db.models.signals import pre_save, post_save
from django.utils.functional import curry
from awx.main.models import ActivityStream, AuthToken
@ -17,7 +17,6 @@ class ActivityStreamMiddleware(object):
user = None
self.instances = []
self.cached_user = None
set_actor = curry(self.set_actor, user)
self.disp_uid = str(uuid.uuid1())
self.finished = False
@ -30,7 +29,7 @@ class ActivityStreamMiddleware(object):
self.finished = True
if self.isActivityStreamEvent:
for instance in self.instances:
if drf_user is not None:
if drf_user is not None and drf_user.__class__ != AnonymousUser:
instance.user = drf_user
instance.save()
else: