chore: merge in and adjust rfceditor.py changes

This commit is contained in:
Robert Sparks 2023-08-17 16:03:17 -05:00
parent 9b59717b39
commit 7441413032
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318

View file

@ -156,7 +156,7 @@ def update_drafts_from_queue(drafts):
names = [t[0] for t in drafts]
drafts_in_db = dict((d.name, d)
for d in Document.objects.filter(type="draft", docalias__name__in=names))
for d in Document.objects.filter(type="draft", name__in=names))
changed = set()
@ -229,7 +229,7 @@ def update_drafts_from_queue(drafts):
# remove tags and states for those not in the queue anymore
for d in Document.objects.exclude(docalias__name__in=names).filter(states__type="draft-rfceditor").distinct():
for d in Document.objects.exclude(name__in=names).filter(states__type="draft-rfceditor").distinct():
d.tags.remove(*list(tag_mapping.values()))
d.unset_state("draft-rfceditor")
# we do not add a history entry here - most likely we already
@ -442,9 +442,6 @@ def update_docs_from_rfc_index(
if created_rfc:
rfc_changes.append(f"created document {prettify_std_name(doc.name)}")
# Create DocAlias (for consistency until we drop DocAlias altogether)
alias, _ = DocAlias.objects.get_or_create(name=doc.name)
alias.docs.add(doc)
rfc_changes.append(f"created alias {prettify_std_name(doc.name)}")
doc.set_state(rfc_published_state)
if draft:
doc.formal_languages.set(draft.formal_languages.all())
@ -654,12 +651,15 @@ def update_docs_from_rfc_index(
)
)
if also:
for a in also:
a = a.lower()
if not DocAlias.objects.filter(name=a):
DocAlias.objects.create(name=a).docs.add(doc)
rfc_changes.append(f"created alias {prettify_std_name(a)}")
# This block attempted to alias subseries names to RFCs.
# Handle that differently when we add subseries as a document type.
#
# if also:
# for a in also:
# a = a.lower()
# if not DocAlias.objects.filter(name=a):
# DocAlias.objects.create(name=a).docs.add(doc)
# rfc_changes.append(f"created alias {prettify_std_name(a)}")
doc_errata = errata.get(f"RFC{rfc_number}", [])
all_rejected = doc_errata and all(