Guard against trying to use .is_authenticated() on a plain string. The error condition can occur when an exception has been triggered before the auth middleware has run. Related to #767 and #768.

- Legacy-Id: 4054
This commit is contained in:
Henrik Levkowetz 2012-03-07 10:00:31 +00:00
parent 8c9404e15e
commit 00111065ea

View file

@ -53,6 +53,8 @@ def is_chair_of_stream(user, stream):
def is_chair_of_streamREDESIGN(user, stream):
if is_secretariat(user):
return True
if isinstance(user, basestring):
return False
return user.is_authenticated() and bool(Role.objects.filter(group__acronym=stream.slug, name="chair", person__user=user))