Skip to content

Commit abab86d

Browse files
committed
Fix a couple of places where we have to handle potential exceptions from the URL reverse() call, because not all old draft names adhere to the current rules. For RFC 1356 the draft name was draft-ietf-iplpdn-x25_isdn (notice the underscore) for which reverse() will fail.
- Legacy-Id: 2998
1 parent 4d22f60 commit abab86d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

ietf/idrfc/views_doc.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from django.utils import simplejson as json
4242
from django.utils.decorators import decorator_from_middleware
4343
from django.middleware.gzip import GZipMiddleware
44-
from django.core.urlresolvers import reverse
44+
from django.core.urlresolvers import reverse, NoReverseMatch
4545

4646
from ietf import settings
4747
from ietf.idtracker.models import InternetDraft, IDInternal, BallotInfo, DocumentComment
@@ -189,10 +189,12 @@ def _get_history(doc, versions):
189189
if doc.is_id_wrapper and doc.draft_status == "Expired" and doc._draft.expiration_date:
190190
results.append({'is_text':True, 'date':doc._draft.expiration_date, 'text':'Draft expired'})
191191
if doc.is_rfc_wrapper:
192+
text = 'RFC Published'
192193
if doc.draft_name:
193-
text = 'RFC Published (see <a href="%s">%s</a> for earlier history)' % (reverse('doc_view', args=[doc.draft_name]),doc.draft_name)
194-
else:
195-
text = 'RFC Published'
194+
try:
195+
text = 'RFC Published (see <a href="%s">%s</a> for earlier history)' % (reverse('doc_view', args=[doc.draft_name]),doc.draft_name)
196+
except NoReverseMatch:
197+
pass
196198
results.append({'is_text':True, 'date':doc.publication_date, 'text':text})
197199

198200
# convert plain dates to datetimes (required for sorting)

ietf/templates/idrfc/doc_tab_document.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
{% if doc.in_ietf_process %}
6060
<span id="doc_edit_state_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_change_state name=doc.draft_name %}">Change state</a></span></span>
6161

62-
<span id="doc_edit_info_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_edit_info name=doc.draft_name %}">Edit</a></span></span>
62+
<span id="doc_edit_info_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url doc_edit_info name=doc.draft_name as doc_edit_url %}{% if doc_edit_url %}<span class="first-child"><a href="{{doc_edit_url}}">Edit</a></span>{% endif %}</span>
6363
{% else %}
64-
<span id="doc_add_button" class="yui-button yui-link-button" style="margin-left:2px;"><span class="first-child"><a href="{% url doc_edit_info name=doc.draft_name %}">Add</a></span></span>
64+
<span id="doc_add_button" class="yui-button yui-link-button" style="margin-left:2px;">{% url doc_edit_info name=doc.draft_name as doc_edit_url %}{% if doc_edit_url %}<span class="first-child"><a href="{{doc_edit_url}}">Add</a></span>{% endif %}</span>
6565
{% endif %}
6666
{% endifequal %}
6767

0 commit comments

Comments
 (0)