Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ietf/bin/rfc-editor-index-updates
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ if len(errata_data) < ietf.sync.rfceditor.MIN_ERRATA_RESULTS:
sys.exit(1)

new_rfcs = []
for changes, doc, rfc_published in ietf.sync.rfceditor.update_docs_from_rfc_index(index_data, errata_data, skip_older_than_date=skip_date):
for rfc_number, changes, doc, rfc_published in ietf.sync.rfceditor.update_docs_from_rfc_index(index_data, errata_data, skip_older_than_date=skip_date):
if rfc_published:
new_rfcs.append(doc)

for c in changes:
log("RFC%s, %s: %s" % (doc.rfc_number, doc.name, c))
log("RFC%s, %s: %s" % (rfc_number, doc.name, c))

sys.exit(0)

Expand Down
9 changes: 5 additions & 4 deletions ietf/sync/rfceditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,11 @@ def extract_doc_list(parentNode, tagName):

def update_docs_from_rfc_index(
index_data, errata_data, skip_older_than_date=None
) -> Iterator[tuple[list[str], Document, bool]]:
) -> Iterator[tuple[int, list[str], Document, bool]]:
"""Given parsed data from the RFC Editor index, update the documents in the database

Yields a list of change descriptions for each document, if any.
Returns an iterator that yields (rfc_number, change_list, doc, rfc_published) for the
RFC document and, if applicable, the I-D that it came from.

The skip_older_than_date is a bare date, not a datetime.
"""
Expand Down Expand Up @@ -553,7 +554,7 @@ def update_docs_from_rfc_index(
)
)
draft.save_with_history(draft_events)
yield draft_changes, draft, False # yield changes to the draft
yield rfc_number, draft_changes, draft, False # yield changes to the draft

# check attributes
verbed = "set" if created_rfc else "changed"
Expand Down Expand Up @@ -757,7 +758,7 @@ def parse_relation_list(l):
)
)
doc.save_with_history(rfc_events)
yield rfc_changes, doc, rfc_published # yield changes to the RFC
yield rfc_number, rfc_changes, doc, rfc_published # yield changes to the RFC

if first_sync_creating_subseries:
# First - create the known subseries documents that have ghosted.
Expand Down
10 changes: 9 additions & 1 deletion ietf/sync/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,16 @@ def test_rfc_index(self):

changes = []
with mock.patch("ietf.sync.rfceditor.log") as mock_log:
for _, d, rfc_published in rfceditor.update_docs_from_rfc_index(data, errata, today - datetime.timedelta(days=30)):
for rfc_number, _, d, rfc_published in rfceditor.update_docs_from_rfc_index(data, errata, today - datetime.timedelta(days=30)):
changes.append({"doc_pk": d.pk, "rfc_published": rfc_published}) # we ignore the actual change list
self.assertEqual(rfc_number, 1234)
if rfc_published:
self.assertEqual(d.type_id, "rfc")
self.assertEqual(d.rfc_number, rfc_number)
else:
self.assertEqual(d.type_id, "draft")
self.assertIsNone(d.rfc_number)

self.assertFalse(mock_log.called, "No log messages expected")

draft_doc = Document.objects.get(name=draft_doc.name)
Expand Down