Skip to content

Commit 4b35ee4

Browse files
committed
Moved code from a couple of simple urlopen() wrappers used only once into the calling scripts. Removed a case of Py2 virtualenv activation.
- Legacy-Id: 17354
1 parent a7982f1 commit 4b35ee4

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

ietf/bin/rfc-editor-index-updates

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import datetime
77
import json
88
import os
9+
import socket
910
import sys
1011
import syslog
1112
import traceback
@@ -46,7 +47,9 @@ if options.skip_date:
4647

4748
log("Updating document metadata from RFC index from %s" % settings.RFC_EDITOR_INDEX_URL)
4849

49-
rfc_index_xml = ietf.sync.rfceditor.fetch_index_xml(settings.RFC_EDITOR_INDEX_URL)
50+
51+
socket.setdefaulttimeout(30)
52+
rfc_index_xml = urlopen(settings.RFC_EDITOR_INDEX_URL)
5053
index_data = ietf.sync.rfceditor.parse_index(rfc_index_xml)
5154

5255
rfc_errata_json = urlopen(settings.RFC_EDITOR_ERRATA_JSON_URL)

ietf/bin/rfc-editor-queue-updates

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
#!/usr/bin/env python
22

3-
import os, sys
3+
import os
4+
import socket
5+
import sys
6+
from six.moves.urllib.request import urlopen
47

58
# boilerplate
69
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
710
sys.path = [ basedir ] + sys.path
811
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
912

10-
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
11-
if os.path.exists(virtualenv_activation):
12-
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
13-
1413
import django
1514
django.setup()
1615

1716
from django.conf import settings
1817

19-
from ietf.sync.rfceditor import fetch_queue_xml, parse_queue, MIN_QUEUE_RESULTS, update_drafts_from_queue
18+
from ietf.sync.rfceditor import parse_queue, MIN_QUEUE_RESULTS, update_drafts_from_queue
2019
from ietf.utils.log import log
2120

2221
log("Updating RFC Editor queue states from %s" % settings.RFC_EDITOR_QUEUE_URL)
2322

24-
response = fetch_queue_xml(settings.RFC_EDITOR_QUEUE_URL)
23+
socket.setdefaulttimeout(30)
24+
response = urlopen(settings.RFC_EDITOR_QUEUE_URL)
2525
drafts, warnings = parse_queue(response)
2626
for w in warnings:
2727
log(u"Warning: %s" % w)

0 commit comments

Comments
 (0)