diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py index a025ae157..eb70e73f4 100644 --- a/ietf/doc/tests.py +++ b/ietf/doc/tests.py @@ -2388,4 +2388,11 @@ class Idnits2SupportTests(TestCase): url = urlreverse('ietf.doc.views_doc.idnits2_rfcs_obsoleted') r = self.client.get(url) self.assertEqual(r.status_code, 200) - self.assertEqual(r.content,b'1001 1003\n1005 1007\n') \ No newline at end of file + self.assertEqual(r.content,b'1001 1003\n1005 1007\n') + + def test_rfc_status(self): + url = urlreverse('ietf.doc.views_doc.idnits2_rfc_status') + r = self.client.get(url) + self.assertEqual(r.status_code,200) + blob = unicontent(r).replace('\n','') + self.assertEqual(blob[6312-1],'O') diff --git a/ietf/doc/urls.py b/ietf/doc/urls.py index f1bb4f08a..887f1c95f 100644 --- a/ietf/doc/urls.py +++ b/ietf/doc/urls.py @@ -70,6 +70,7 @@ urlpatterns = [ url(r'^html/%(name)s(?:-%(rev)s)?(\.txt|\.html)?/?$' % settings.URL_REGEXPS, views_doc.document_html), url(r'^html/(?P[Rr][Ff][Cc] [0-9]+?)(\.txt|\.html)?/?$', views_doc.document_html), url(r'^idnits2-rfcs-obsoleted/?$', views_doc.idnits2_rfcs_obsoleted), + url(r'^idnits2-rfc-status/?$', views_doc.idnits2_rfc_status), url(r'^all/?$', views_search.index_all_drafts), url(r'^active/?$', views_search.index_active_drafts), diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index 20385cf9d..53711ee81 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -41,6 +41,7 @@ import json import os import re import markdown +import textwrap from collections import defaultdict from urllib.parse import quote @@ -1730,3 +1731,45 @@ def idnits2_rfcs_obsoleted(request): return render(request, 'doc/idnits2-rfcs-obsoleted.txt', context={'obsitems':sorted(obsdict.items())},content_type='text/plain;charset=utf-8') +@cache_page ( 60 * 60, cache="slowpages" ) +def idnits2_rfc_status(request): + + blob=['N']*10000 + + symbols={ + 'ps': 'P', + 'inf': 'I', + 'exp': 'E', + 'ds': 'D', + 'hist': 'H', + 'std': 'S', + 'bcp': 'B', + 'unkn': 'U', + } + + rfcs = Document.objects.filter(type_id='draft',states__slug='rfc',states__type='draft') + for rfc in rfcs: + offset = int(rfc.rfcnum)-1 + blob[offset] = symbols[rfc.std_level_id] + if rfc.related_that('obs'): + blob[offset] = 'O' + + # Workarounds for unusual states in the datatracker + + # Document.get(docalias='rfc6312').rfcnum == 6342 + # 6312 was published with the wrong rfc number in it + # weird workaround in the datatracker - there are two + # DocAliases starting with rfc - the canonical name code + # searches for the lexically highest alias starting with rfc + # which is getting lucky. + blob[6312 - 1] = 'O' + + # RFC200 is an old RFC List by Number + blob[200 -1] = 'O' + + # End Workarounds + + blob = re.sub('N*$','',''.join(blob)) + + return HttpResponse(textwrap.fill(blob, width=64),content_type='text/plain;charset=utf-8') + diff --git a/ietf/templates/doc/idnits2-rfcs-obsoleted.txt b/ietf/templates/doc/idnits2-rfcs-obsoleted.txt new file mode 100644 index 000000000..07910d4f1 --- /dev/null +++ b/ietf/templates/doc/idnits2-rfcs-obsoleted.txt @@ -0,0 +1,2 @@ +{% load ietf_filters %}{% filter linebreaks_lf %}{% for k,l in obsitems %}{{k}} {{l|join:" "}} +{% endfor %}{% endfilter %} \ No newline at end of file