Skip to content

Commit 9744ae1

Browse files
committed
Reverted r18858. More work is needed.
- Legacy-Id: 18873
1 parent 5b43494 commit 9744ae1

4 files changed

Lines changed: 13 additions & 22 deletions

File tree

ietf/doc/tests.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -930,21 +930,13 @@ def test_document_primary_and_history_views(self):
930930
doc.rev = "01"
931931
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_document", by=Person.objects.get(user__username="secretary"), desc="Test")])
932932

933-
# Fetch the main page resulting latest version
934933
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
935934
self.assertEqual(r.status_code, 200)
936935
self.assertContains(r, "%s-01"%docname)
937-
938-
# Fetch 01 version even when it is last version
936+
939937
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="01")))
940-
self.assertEqual(r.status_code, 200)
941-
self.assertContains(r, "%s-01"%docname)
942-
943-
# Fetch version number which is too large, that should redirect to main page
944-
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="02")))
945938
self.assertEqual(r.status_code, 302)
946-
947-
# Fetch 00 version which should result that version
939+
948940
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="00")))
949941
self.assertEqual(r.status_code, 200)
950942
self.assertContains(r, "%s-00"%docname)

ietf/doc/views_doc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ def document_main(request, name, rev=None):
139139

140140
gh = None
141141
if rev != None:
142+
if rev == doc.rev:
143+
return redirect('ietf.doc.views_doc.document_main', name=name)
144+
142145
# find the entry in the history
143146
for h in doc.history_set.order_by("-time"):
144147
if rev == h.rev:
@@ -207,7 +210,7 @@ def document_main(request, name, rev=None):
207210

208211
latest_revision = None
209212

210-
if not snapshot and doc.get_state_slug() == "rfc":
213+
if doc.get_state_slug() == "rfc":
211214
# content
212215
content = doc.text_or_error() # pyflakes:ignore
213216
content = markup_txt.markup(maybe_split(content, split=split_content))

ietf/templates/doc/document_draft.html

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
{% block pagehead %}
99
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ name }}/">
10-
<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 %}">
10+
<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 %}">
1111
<script src="{% static 'd3/d3.min.js' %}"></script>
1212
<script src="{% static 'jquery/jquery.min.js' %}"></script>
1313
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
@@ -18,7 +18,7 @@
1818
{% endblock %}
1919

2020
{% block title %}
21-
{% if doc.get_state_slug == "rfc" and not snapshot %}
21+
{% if doc.get_state_slug == "rfc" %}
2222
RFC {{ rfc_number }} - {{ doc.title }}
2323
{% else %}
2424
{{ name }}-{{ doc.rev }} - {{ doc.title }}
@@ -38,11 +38,7 @@
3838
{% if doc.rev != latest_rev %}
3939
<th colspan="4" class="alert-warning">The information below is for an old version of the document</th>
4040
{% else %}
41-
{% if doc.get_state_slug == "rfc" and snapshot %}
42-
<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>
43-
{% else %}
44-
<th colspan="4"></th>
45-
{% endif %}
41+
<th colspan="4"></th>
4642
{% endif %}
4743
</tr>
4844
</thead>
@@ -53,7 +49,7 @@
5349
<th>Type</th>
5450
<td class="edit"></td>
5551
<td>
56-
{% if doc.get_state_slug == "rfc" and not snapshot %}
52+
{% if doc.get_state_slug == "rfc" %}
5753
RFC - {{ doc.std_level }}
5854
({% 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 %})
5955

@@ -174,7 +170,7 @@
174170
</td>
175171
</tr>
176172

177-
{% if doc.get_state_slug != "rfc" and not snapshot %}
173+
{% if doc.get_state_slug != "rfc" %}
178174
<tr>
179175
<th></th>
180176
<th>Intended RFC status</th>

ietf/templates/doc/revisions_list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<ul class="pagination revlist">
33
<li class="disabled"><a><b>Versions</b></a></li>
44
{% for rev in revisions %}
5-
<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 %}>
6-
<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>
5+
<li {% if rev == doc.rev %}{% if rev == latest_rev %}class="active"{% else %}class="warning"{% endif %}{% endif %}>
6+
<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>
77
</li>
88
{% endfor %}
99
</ul>

0 commit comments

Comments
 (0)