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: 4052
This commit is contained in:
Henrik Levkowetz 2012-03-07 09:57:56 +00:00
parent 0736dec160
commit e6c42e76e9

View file

@ -453,7 +453,7 @@ def format_history_text(text):
@register.filter
def user_roles_json(user):
roles = {}
if user.is_authenticated():
if not isinstance(user, basestring) and user.is_authenticated():
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
from ietf.group.models import Role
for r in Role.objects.filter(person__user=user).select_related(depth=1):