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
This commit is contained in:
Henrik Levkowetz 2020-08-28 12:57:22 +00:00
parent 1b2900007a
commit 5a64d6027c

View file

@ -47,6 +47,7 @@ from django.http import HttpResponse, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.template.loader import render_to_string
from django.urls import reverse as urlreverse
from django.urls.exceptions import NoReverseMatch
from django.conf import settings
from django import forms
@ -290,7 +291,10 @@ def document_main(request, name, rev=None):
submission = "individual in %s area" % group.acronym
else:
submission = "%s %s" % (group.acronym, group.type)
submission = "<a href=\"%s\">%s</a>" % (urlreverse("ietf.group.views.group_home", kwargs=dict(group_type=group.type_id, acronym=group.acronym)), submission)
try:
submission = "<a href=\"%s\">%s</a>" % (urlreverse("ietf.group.views.group_home", kwargs=dict(group_type=group.type_id, acronym=group.acronym)), submission)
except NoReverseMatch:
pass
if doc.stream_id and doc.get_state_slug("draft-stream-%s" % doc.stream_id) == "c-adopt":
submission = "candidate for %s" % submission