Skip to content

Commit 63f4234

Browse files
committed
If the slug isn't in the I-D tracker, but is in the I-D database,
supply a pointer instead of a 404. Still return 404 for slugs that are not I-D filenames at all. Related to adamlaska#203. (I don't know if it fixes it completely since you might have had something else in mind for the content.) - Legacy-Id: 879
1 parent 4a1b97c commit 63f4234

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

ietf/idtracker/views.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,19 @@ def redirect_id(request, object_id):
196196
doc = get_object_or_404(InternetDraft, id_document_tag=object_id)
197197
return HttpResponsePermanentRedirect(reverse(view_id, args=[doc.filename]))
198198

199+
# calling sequence similar to object_detail, but we have different
200+
# 404 handling: if the draft exists, render a not-found template.
201+
def view_id(request, queryset, slug, slug_field):
202+
try:
203+
object = IDInternal.objects.get(draft__filename=slug, rfc_flag=0)
204+
except IDInternal.DoesNotExist:
205+
draft = get_object_or_404(InternetDraft, filename=slug)
206+
return render_to_response('idtracker/idinternal_notfound.html', {'draft': draft}, context_instance=RequestContext(request))
207+
return render_to_response('idtracker/idinternal_detail.html', {'object': object}, context_instance=RequestContext(request))
208+
199209
# Wrappers around object_detail to give permalink a handle.
200210
# The named-URLs feature in django 0.97 will eliminate the
201211
# need for these.
202-
def view_id(*args, **kwargs):
203-
return object_detail(*args, **kwargs)
204-
205212
def view_comment(*args, **kwargs):
206213
return object_detail(*args, **kwargs)
207214

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "base.html" %}
2+
3+
{% block title %}Not Found - {{ draft.filename }}{% endblock %}
4+
5+
{% block content %}
6+
<h1>Not in I-D Tracker</h1>
7+
8+
<p>{{ draft.filename }} is not in the I-D tracker, although it is
9+
an {{ draft.status.status|lower }} Internet Draft. The
10+
<a href="{% url ietf.idindex.views.view_id draft.filename %}">Internet-Drafts Database Index</a>
11+
has more information on the status of this document.
12+
</p>
13+
14+
{% endblock %}

0 commit comments

Comments
 (0)