Skip to content

Commit 9c6fd95

Browse files
committed
Add date option to RFC Editor index mirroring script so one can
control what the publication cut off date is, also fix crash problem with some old RFCs not having a page count - Legacy-Id: 4907
1 parent 4aef918 commit 9c6fd95

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

ietf/bin/rfc-editor-index-updates

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ from django.core import management
1414
management.setup_environ(settings)
1515

1616

17+
from optparse import OptionParser
18+
19+
parser = OptionParser()
20+
parser.add_option("-d", dest="skip_date",
21+
help="To speed up processing skip RFCs published before this date (default is one year ago)", metavar="YYYY-MM-DD")
22+
23+
options, args = parser.parse_args()
24+
25+
skip_date = datetime.date.today() - datetime.timedelta(days=365)
26+
if options.skip_date:
27+
skip_date = datetime.datetime.strptime(options.skip_date, "%Y-%m-%d").date()
28+
1729
from ietf.sync.rfceditor import *
1830

1931
syslog.syslog("Updating document metadata from RFC index from %s" % QUEUE_URL)
@@ -25,6 +37,6 @@ if len(data) < MIN_INDEX_RESULTS:
2537
syslog.syslog("Not enough results, only %s" % len(data))
2638
sys.exit(1)
2739

28-
changed = update_docs_from_rfc_index(data)
40+
changed = update_docs_from_rfc_index(data, skip_older_than_date=skip_date)
2941
for c in changed:
3042
syslog.syslog(c)

ietf/sync/rfceditor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ def getDocList(parentNode, tagName):
273273
return data
274274

275275

276-
#skip_older_than_date = date.today() - timedelta(days=365)
277276
def update_docs_from_rfc_index(data, skip_older_than_date=None):
278277
std_level_mapping = {
279278
"Standard": StdLevelName.objects.get(slug="std"),
@@ -347,7 +346,7 @@ def update_docs_from_rfc_index(data, skip_older_than_date=None):
347346
if abstract and abstract != doc.abstract:
348347
changed_attributes["abstract"] = abstract
349348

350-
if int(pages) != doc.pages:
349+
if pages and int(pages) != doc.pages:
351350
changed_attributes["pages"] = int(pages)
352351

353352
if std_level_mapping[current_status] != doc.std_level:

0 commit comments

Comments
 (0)