Reverted r18858. More work is needed.

- Legacy-Id: 18873
This commit is contained in:
Robert Sparks 2021-03-02 18:35:34 +00:00
parent 5b43494421
commit 9744ae12e5
4 changed files with 13 additions and 22 deletions

View file

@ -930,21 +930,13 @@ Man Expires September 22, 2015 [Page 3]
doc.rev = "01"
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_document", by=Person.objects.get(user__username="secretary"), desc="Test")])
# Fetch the main page resulting latest version
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(r.status_code, 200)
self.assertContains(r, "%s-01"%docname)
# Fetch 01 version even when it is last version
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="01")))
self.assertEqual(r.status_code, 200)
self.assertContains(r, "%s-01"%docname)
# Fetch version number which is too large, that should redirect to main page
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="02")))
self.assertEqual(r.status_code, 302)
# Fetch 00 version which should result that version
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="00")))
self.assertEqual(r.status_code, 200)
self.assertContains(r, "%s-00"%docname)

View file

@ -139,6 +139,9 @@ def document_main(request, name, rev=None):
gh = None
if rev != None:
if rev == doc.rev:
return redirect('ietf.doc.views_doc.document_main', name=name)
# find the entry in the history
for h in doc.history_set.order_by("-time"):
if rev == h.rev:
@ -207,7 +210,7 @@ def document_main(request, name, rev=None):
latest_revision = None
if not snapshot and doc.get_state_slug() == "rfc":
if doc.get_state_slug() == "rfc":
# content
content = doc.text_or_error() # pyflakes:ignore
content = markup_txt.markup(maybe_split(content, split=split_content))

View file

@ -7,7 +7,7 @@
{% block pagehead %}
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ name }}/">
<meta name="description" content="{{ doc.title }} {% if doc.get_state_slug == "rfc" and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ published.time|date:"F Y" }}{% endif %}{% if obsoleted_by %}; obsoleted by {{ obsoleted_by|join:", " }}{% endif %}){% else %}(Internet-Draft, {{ doc.time|date:"Y" }}){% endif %}">
<meta name="description" content="{{ doc.title }} {% if doc.get_state_slug == "rfc" %}(RFC {{ rfc_number }}{% if published %}, {{ published.time|date:"F Y" }}{% endif %}{% if obsoleted_by %}; obsoleted by {{ obsoleted_by|join:", " }}{% endif %}){% else %}(Internet-Draft, {{ doc.time|date:"Y" }}){% endif %}">
<script src="{% static 'd3/d3.min.js' %}"></script>
<script src="{% static 'jquery/jquery.min.js' %}"></script>
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
@ -18,7 +18,7 @@
{% endblock %}
{% block title %}
{% if doc.get_state_slug == "rfc" and not snapshot %}
{% if doc.get_state_slug == "rfc" %}
RFC {{ rfc_number }} - {{ doc.title }}
{% else %}
{{ name }}-{{ doc.rev }} - {{ doc.title }}
@ -38,11 +38,7 @@
{% if doc.rev != latest_rev %}
<th colspan="4" class="alert-warning">The information below is for an old version of the document</th>
{% else %}
{% if doc.get_state_slug == "rfc" and snapshot %}
<th colspan="4" class="alert-warning">The information below is for an old version of the document that is already published as an RFC</th>
{% else %}
<th colspan="4"></th>
{% endif %}
<th colspan="4"></th>
{% endif %}
</tr>
</thead>
@ -53,7 +49,7 @@
<th>Type</th>
<td class="edit"></td>
<td>
{% if doc.get_state_slug == "rfc" and not snapshot %}
{% if doc.get_state_slug == "rfc" %}
RFC - {{ doc.std_level }}
({% if published %}{{ published.time|date:"F Y" }}{% else %}publication date unknown{% endif %}{% if has_errata %}; <a href="https://www.rfc-editor.org/errata_search.php?rfc={{ rfc_number }}" rel="nofollow">Errata</a>{% else %}; No errata{% endif %})
@ -174,7 +170,7 @@
</td>
</tr>
{% if doc.get_state_slug != "rfc" and not snapshot %}
{% if doc.get_state_slug != "rfc" %}
<tr>
<th></th>
<th>Intended RFC status</th>

View file

@ -2,8 +2,8 @@
<ul class="pagination revlist">
<li class="disabled"><a><b>Versions</b></a></li>
{% for rev in revisions %}
<li {% if rev == doc.rev %}{% if snapshot or not doc.get_state_slug == "rfc" %}{% if rev == latest_rev and not doc.get_state_slug == "rfc" %}class="active"{% else %}class="warning"{% endif %}{% endif %}{% endif %}>
<a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}{{ rev }}/" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
<li {% if rev == doc.rev %}{% if rev == latest_rev %}class="active"{% else %}class="warning"{% endif %}{% endif %}>
<a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}{% if not forloop.last %}{{ rev }}/{% endif %}" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
</li>
{% endfor %}
</ul>