Skip to content

Commit c760b48

Browse files
committed
Make streams_menu tag more robust in the face of "request" missing
from context, this would normally be an error but it can happen if a 404 is returned - Legacy-Id: 6268
1 parent 56ea114 commit c760b48

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ietf/doc/templatetags/streams_menu.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django import template
22
from django.conf import settings
33
from django.core.urlresolvers import reverse as urlreverse
4+
from django.contrib.auth.models import AnonymousUser
45

56
from ietf.ietfauth.utils import has_role
67
from ietf.group.models import Group
@@ -10,10 +11,10 @@
1011

1112
@register.inclusion_tag('base/streams_menu.html', takes_context=True)
1213
def streams_menu(context):
13-
user = context["request"].user
14-
1514
editable_streams = []
1615

16+
user = context["request"].user if "request" in context else AnonymousUser()
17+
1718
if user.is_authenticated():
1819
streams = StreamName.objects.exclude(slug="legacy")
1920

0 commit comments

Comments
 (0)