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
This commit is contained in:
Robert Sparks 2021-07-28 18:24:12 +00:00
parent 3283645252
commit b179143303
4 changed files with 54 additions and 1 deletions

View file

@ -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')
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')

View file

@ -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<name>[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),

View file

@ -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')

View file

@ -0,0 +1,2 @@
{% load ietf_filters %}{% filter linebreaks_lf %}{% for k,l in obsitems %}{{k}} {{l|join:" "}}
{% endfor %}{% endfilter %}