Skip to content

Commit 5a64d60

Browse files
committed
Added exception catching around an urlreverse that might fail. (Enumerating valid group types will also work, but can get out of sync, so this is more DRY).
- Legacy-Id: 18437
1 parent 1b29000 commit 5a64d60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ietf/doc/views_doc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from django.shortcuts import render, get_object_or_404, redirect
4848
from django.template.loader import render_to_string
4949
from django.urls import reverse as urlreverse
50+
from django.urls.exceptions import NoReverseMatch
5051
from django.conf import settings
5152
from django import forms
5253

@@ -290,7 +291,10 @@ def document_main(request, name, rev=None):
290291
submission = "individual in %s area" % group.acronym
291292
else:
292293
submission = "%s %s" % (group.acronym, group.type)
293-
submission = "<a href=\"%s\">%s</a>" % (urlreverse("ietf.group.views.group_home", kwargs=dict(group_type=group.type_id, acronym=group.acronym)), submission)
294+
try:
295+
submission = "<a href=\"%s\">%s</a>" % (urlreverse("ietf.group.views.group_home", kwargs=dict(group_type=group.type_id, acronym=group.acronym)), submission)
296+
except NoReverseMatch:
297+
pass
294298
if doc.stream_id and doc.get_state_slug("draft-stream-%s" % doc.stream_id) == "c-adopt":
295299
submission = "candidate for %s" % submission
296300

0 commit comments

Comments
 (0)