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 #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
This commit is contained in:
Bill Fenner 2007-07-09 20:13:10 +00:00
parent 4a1b97c37a
commit 63f4234f56
2 changed files with 24 additions and 3 deletions

View file

@ -196,12 +196,19 @@ def redirect_id(request, object_id):
doc = get_object_or_404(InternetDraft, id_document_tag=object_id)
return HttpResponsePermanentRedirect(reverse(view_id, args=[doc.filename]))
# calling sequence similar to object_detail, but we have different
# 404 handling: if the draft exists, render a not-found template.
def view_id(request, queryset, slug, slug_field):
try:
object = IDInternal.objects.get(draft__filename=slug, rfc_flag=0)
except IDInternal.DoesNotExist:
draft = get_object_or_404(InternetDraft, filename=slug)
return render_to_response('idtracker/idinternal_notfound.html', {'draft': draft}, context_instance=RequestContext(request))
return render_to_response('idtracker/idinternal_detail.html', {'object': object}, context_instance=RequestContext(request))
# Wrappers around object_detail to give permalink a handle.
# The named-URLs feature in django 0.97 will eliminate the
# need for these.
def view_id(*args, **kwargs):
return object_detail(*args, **kwargs)
def view_comment(*args, **kwargs):
return object_detail(*args, **kwargs)

View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block title %}Not Found - {{ draft.filename }}{% endblock %}
{% block content %}
<h1>Not in I-D Tracker</h1>
<p>{{ draft.filename }} is not in the I-D tracker, although it is
an {{ draft.status.status|lower }} Internet Draft. The
<a href="{% url ietf.idindex.views.view_id draft.filename %}">Internet-Drafts Database Index</a>
has more information on the status of this document.
</p>
{% endblock %}