1- # Copyright The IETF Trust 2012-2019 , All Rights Reserved
1+ # Copyright The IETF Trust 2012-2020 , All Rights Reserved
22# -*- coding: utf-8 -*-
33
44
3232#INDEX_URL = "https://www.rfc-editor.org/rfc/rfc-index.xml"
3333#POST_APPROVED_DRAFT_URL = "https://www.rfc-editor.org/sdev/jsonexp/jsonparser.php"
3434
35+ MIN_ERRATA_RESULTS = 5000
36+ MIN_INDEX_RESULTS = 8000
3537MIN_QUEUE_RESULTS = 10
36- MIN_INDEX_RESULTS = 5000
3738
3839def get_child_text (parent_node , tag_name ):
3940 text = []
@@ -330,11 +331,18 @@ def extract_doc_list(parentNode, tagName):
330331 return data
331332
332333
333- def update_docs_from_rfc_index (data , skip_older_than_date = None ):
334+ def update_docs_from_rfc_index (index_data , errata_data , skip_older_than_date = None ):
334335 """Given parsed data from the RFC Editor index, update the documents
335336 in the database. Yields a list of change descriptions for each
336337 document, if any."""
337338
339+ errata = {}
340+ for item in errata_data :
341+ name = item ['doc-id' ]
342+ if not name in errata :
343+ errata [name ] = []
344+ errata [name ].append (item )
345+
338346 std_level_mapping = {
339347 "Standard" : StdLevelName .objects .get (slug = "std" ),
340348 "Internet Standard" : StdLevelName .objects .get (slug = "std" ),
@@ -356,12 +364,13 @@ def update_docs_from_rfc_index(data, skip_older_than_date=None):
356364 }
357365
358366 tag_has_errata = DocTagName .objects .get (slug = 'errata' )
367+ tag_has_verified_errata = DocTagName .objects .get (slug = 'verified-errata' )
359368 relationship_obsoletes = DocRelationshipName .objects .get (slug = "obs" )
360369 relationship_updates = DocRelationshipName .objects .get (slug = "updates" )
361370
362371 system = Person .objects .get (name = "(System)" )
363372
364- for rfc_number , title , authors , rfc_published_date , current_status , updates , updated_by , obsoletes , obsoleted_by , also , draft , has_errata , stream , wg , file_formats , pages , abstract in data :
373+ for rfc_number , title , authors , rfc_published_date , current_status , updates , updated_by , obsoletes , obsoleted_by , also , draft , has_errata , stream , wg , file_formats , pages , abstract in index_data :
365374
366375 if skip_older_than_date and rfc_published_date < skip_older_than_date :
367376 # speed up the process by skipping old entries
@@ -493,13 +502,20 @@ def parse_relation_list(l):
493502 changes .append ("created alias %s" % prettify_std_name (a ))
494503
495504 if has_errata :
496- if not doc .tags .filter (pk = tag_has_errata .pk ):
505+ if not doc .tags .filter (pk = tag_has_errata .pk ). exists () :
497506 doc .tags .add (tag_has_errata )
498507 changes .append ("added Errata tag" )
508+ has_verified_errata = name .upper () in errata and any ([ e ['errata_status_code' ]== 'Verified' for e in errata [name .upper ()] ])
509+ if has_verified_errata and not doc .tags .filter (pk = tag_has_verified_errata .pk ).exists ():
510+ doc .tags .add (tag_has_verified_errata )
511+ changes .append ("added Verified Errata tag" )
499512 else :
500513 if doc .tags .filter (pk = tag_has_errata .pk ):
501514 doc .tags .remove (tag_has_errata )
502515 changes .append ("removed Errata tag" )
516+ if doc .tags .filter (pk = tag_has_verified_errata .pk ):
517+ doc .tags .remove (tag_has_verified_errata )
518+ changes .append ("removed Verified Errata tag" )
503519
504520 if changes :
505521 events .append (DocEvent .objects .create (
0 commit comments