Skip to content

Commit b179143

Browse files
committed
Supply missing template for idnits2-rfcs-obsoleted. Add a view that provides the rfc-status blob used by idnits. Commit ready for merge.
- Legacy-Id: 19263
1 parent 3283645 commit b179143

4 files changed

Lines changed: 54 additions & 1 deletion

File tree

ietf/doc/tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2388,4 +2388,11 @@ def test_obsoleted(self):
23882388
url = urlreverse('ietf.doc.views_doc.idnits2_rfcs_obsoleted')
23892389
r = self.client.get(url)
23902390
self.assertEqual(r.status_code, 200)
2391-
self.assertEqual(r.content,b'1001 1003\n1005 1007\n')
2391+
self.assertEqual(r.content,b'1001 1003\n1005 1007\n')
2392+
2393+
def test_rfc_status(self):
2394+
url = urlreverse('ietf.doc.views_doc.idnits2_rfc_status')
2395+
r = self.client.get(url)
2396+
self.assertEqual(r.status_code,200)
2397+
blob = unicontent(r).replace('\n','')
2398+
self.assertEqual(blob[6312-1],'O')

ietf/doc/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
url(r'^html/%(name)s(?:-%(rev)s)?(\.txt|\.html)?/?$' % settings.URL_REGEXPS, views_doc.document_html),
7171
url(r'^html/(?P<name>[Rr][Ff][Cc] [0-9]+?)(\.txt|\.html)?/?$', views_doc.document_html),
7272
url(r'^idnits2-rfcs-obsoleted/?$', views_doc.idnits2_rfcs_obsoleted),
73+
url(r'^idnits2-rfc-status/?$', views_doc.idnits2_rfc_status),
7374

7475
url(r'^all/?$', views_search.index_all_drafts),
7576
url(r'^active/?$', views_search.index_active_drafts),

ietf/doc/views_doc.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import os
4242
import re
4343
import markdown
44+
import textwrap
4445

4546
from collections import defaultdict
4647
from urllib.parse import quote
@@ -1730,3 +1731,45 @@ def idnits2_rfcs_obsoleted(request):
17301731

17311732
return render(request, 'doc/idnits2-rfcs-obsoleted.txt', context={'obsitems':sorted(obsdict.items())},content_type='text/plain;charset=utf-8')
17321733

1734+
@cache_page ( 60 * 60, cache="slowpages" )
1735+
def idnits2_rfc_status(request):
1736+
1737+
blob=['N']*10000
1738+
1739+
symbols={
1740+
'ps': 'P',
1741+
'inf': 'I',
1742+
'exp': 'E',
1743+
'ds': 'D',
1744+
'hist': 'H',
1745+
'std': 'S',
1746+
'bcp': 'B',
1747+
'unkn': 'U',
1748+
}
1749+
1750+
rfcs = Document.objects.filter(type_id='draft',states__slug='rfc',states__type='draft')
1751+
for rfc in rfcs:
1752+
offset = int(rfc.rfcnum)-1
1753+
blob[offset] = symbols[rfc.std_level_id]
1754+
if rfc.related_that('obs'):
1755+
blob[offset] = 'O'
1756+
1757+
# Workarounds for unusual states in the datatracker
1758+
1759+
# Document.get(docalias='rfc6312').rfcnum == 6342
1760+
# 6312 was published with the wrong rfc number in it
1761+
# weird workaround in the datatracker - there are two
1762+
# DocAliases starting with rfc - the canonical name code
1763+
# searches for the lexically highest alias starting with rfc
1764+
# which is getting lucky.
1765+
blob[6312 - 1] = 'O'
1766+
1767+
# RFC200 is an old RFC List by Number
1768+
blob[200 -1] = 'O'
1769+
1770+
# End Workarounds
1771+
1772+
blob = re.sub('N*$','',''.join(blob))
1773+
1774+
return HttpResponse(textwrap.fill(blob, width=64),content_type='text/plain;charset=utf-8')
1775+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{% load ietf_filters %}{% filter linebreaks_lf %}{% for k,l in obsitems %}{{k}} {{l|join:" "}}
2+
{% endfor %}{% endfilter %}

0 commit comments

Comments
 (0)