Skip to content

Commit e6c42e7

Browse files
committed
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 ietf-tools#767 and ietf-tools#768.
- Legacy-Id: 4052
1 parent 0736dec commit e6c42e7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ietf/idtracker/templatetags/ietf_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def format_history_text(text):
453453
@register.filter
454454
def user_roles_json(user):
455455
roles = {}
456-
if user.is_authenticated():
456+
if not isinstance(user, basestring) and user.is_authenticated():
457457
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
458458
from ietf.group.models import Role
459459
for r in Role.objects.filter(person__user=user).select_related(depth=1):

0 commit comments

Comments
 (0)