Skip to content

Commit 10396d6

Browse files
authored
chore: remove more tools.ietf.org server only related things. (ietf-tools#4103)
* chore: remove more tools.ietf.org server only related things. * chore: remove use of tools.ietf.org floorplans\n\nThe data will move into the FloorPlan models instead.
1 parent 7da2795 commit 10396d6

6 files changed

Lines changed: 32 additions & 102 deletions

File tree

ietf/ipr/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2007-2020, All Rights Reserved
1+
# Copyright The IETF Trust 2007-2022, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -460,7 +460,7 @@ def by_draft_txt(request):
460460

461461
def by_draft_recursive_txt(request):
462462
"""Returns machine-readable list of IPR disclosures by draft name, recursive.
463-
NOTE: this view is expensive and should be removed once tools.ietf.org is retired,
463+
NOTE: this view is expensive and should be removed _after_ tools.ietf.org is retired,
464464
including util function and management commands that generate the content for
465465
this view."""
466466

@@ -856,4 +856,4 @@ def update(request, id):
856856
ipr = get_object_or_404(IprDisclosureBase,id=id)
857857
child = ipr.get_child()
858858
type = class_to_type[child.__class__.__name__]
859-
return new(request, type, updates=id)
859+
return new(request, type, updates=id)

ietf/meeting/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ def floorplan_url(self):
456456
mtg_num = self.meeting.get_number()
457457
if not mtg_num:
458458
return None
459-
elif mtg_num <= settings.FLOORPLAN_LAST_LEGACY_MEETING:
460-
base_url = settings.FLOORPLAN_LEGACY_BASE_URL.format(meeting=self.meeting)
461459
elif self.floorplan:
462460
base_url = urlreverse('ietf.meeting.views.floor_plan', kwargs=dict(num=mtg_num))
463461
else:

ietf/settings.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2007-2020, All Rights Reserved
1+
# Copyright The IETF Trust 2007-2022, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -73,7 +73,7 @@
7373

7474
DEFAULT_FROM_EMAIL = 'IETF Secretariat <ietf-secretariat-reply@' + IETF_DOMAIN + '>'
7575
UTILS_ON_BEHALF_EMAIL = 'noreply@' + IETF_DOMAIN
76-
UTILS_FROM_EMAIL_DOMAINS = [ 'ietf.org', 'iab.org', 'tools.ietf.org', ]
76+
UTILS_FROM_EMAIL_DOMAINS = [ 'ietf.org', 'iab.org', ]
7777

7878
MANAGERS = ADMINS
7979

@@ -536,7 +536,6 @@ def skip_unreadable_post(record):
536536
IDTRACKER_BASE_URL = "https://datatracker.ietf.org"
537537
RFCDIFF_BASE_URL = "https://www.ietf.org/rfcdiff"
538538
IDNITS_BASE_URL = "https://www.ietf.org/tools/idnits"
539-
XML2RFC_BASE_URL = "https://xml2rfc.tools.ietf.org/experimental.html"
540539

541540
# Content security policy configuration (django-csp)
542541
CSP_DEFAULT_SRC = ("'self'", "'unsafe-inline'", f"data: {IDTRACKER_BASE_URL} https://www.ietf.org/ https://analytics.ietf.org/")
@@ -867,7 +866,6 @@ def skip_unreadable_post(record):
867866
IDSUBMIT_MAX_DAILY_SUBMISSIONS = 1000
868867
IDSUBMIT_MAX_DAILY_SUBMISSIONS_SIZE = 2000 # in MB
869868

870-
XML_LIBRARY = "/www/tools.ietf.org/tools/xml2rfc/web/public/rfc/"
871869

872870
# === Meeting Related Settings =================================================
873871

@@ -961,8 +959,7 @@ def skip_unreadable_post(record):
961959

962960
FLOORPLAN_MEDIA_DIR = 'floor'
963961
FLOORPLAN_DIR = os.path.join(MEDIA_ROOT, FLOORPLAN_MEDIA_DIR)
964-
FLOORPLAN_LEGACY_BASE_URL = 'https://tools.ietf.org/agenda/{meeting.number}/venue/'
965-
FLOORPLAN_LAST_LEGACY_MEETING = 95 # last meeting to use FLOORPLAN_LEGACY_BASE_URL
962+
966963

967964
MEETING_USES_CODIMD_DATE = datetime.date(2020,7,6)
968965
MEETING_LEGACY_OFFICE_HOURS_END = 112 # last meeting to use legacy office hours representation

ietf/submit/forms.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2011-2020, All Rights Reserved
1+
# Copyright The IETF Trust 2011-2022, All Rights Reserved
22
# -*- coding: utf-8 -*-
33

44

@@ -188,7 +188,6 @@ def cleanup(): # called when context exited, even in case of exception
188188
tfn = tf.name
189189
for chunk in xml_file.chunks():
190190
tf.write(chunk)
191-
os.environ["XML_LIBRARY"] = settings.XML_LIBRARY
192191

193192
parser = xml2rfc.XmlRfcParser(str(tfn), quiet=True)
194193
# --- Parse the xml ---
@@ -668,4 +667,4 @@ def __init__(self, *args, **kwargs):
668667
super(MessageModelForm, self).__init__(*args, **kwargs)
669668
self.fields['frm'].label='From'
670669
self.fields['frm'].widget.attrs['readonly'] = True
671-
self.fields['reply_to'].widget.attrs['readonly'] = True
670+
self.fields['reply_to'].widget.attrs['readonly'] = True

ietf/utils/draft.py

Lines changed: 23 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/python
2-
# Copyright The IETF Trust 2009-2021, All Rights Reserved
2+
# Copyright The IETF Trust 2009-2022, All Rights Reserved
33
# -*- coding: utf-8 -*-
44
# -*- python -*-
55

@@ -63,7 +63,6 @@
6363
opt_timestamp = False
6464
opt_trace = False
6565
opt_authorinfo = False
66-
opt_getauthors = False
6766
opt_attributes = False
6867
# Don't forget to add the option variable to the globals list in _main below
6968

@@ -1243,28 +1242,6 @@ def getmeta(fn):
12431242
filename = fn
12441243
fn = os.path.basename(fn)
12451244
else:
1246-
if fn.lower().startswith('rfc'):
1247-
filename = os.path.join("/www/tools.ietf.org/rfc", fn)
1248-
elif not "/" in fn:
1249-
filename = os.path.join("/www/tools.ietf.org/id", fn)
1250-
if not os.path.exists(filename):
1251-
fn = filename
1252-
while not "-00." in fn:
1253-
revmatch = re.search(r"-(\d\d)\.", fn)
1254-
if revmatch:
1255-
rev = revmatch.group(1)
1256-
prev = "%02d" % (int(rev)-1)
1257-
fn = fn.replace("-%s."%rev, "-%s."%prev)
1258-
if os.path.exists(fn):
1259-
_warn("Using rev %s instead: '%s'" % (prev, filename))
1260-
filename = fn
1261-
fn = os.path.basename(fn)
1262-
break
1263-
else:
1264-
break
1265-
else:
1266-
filename = fn
1267-
if not os.path.exists(filename):
12681245
_warn("Could not find file: '%s'" % (filename))
12691246
return
12701247

@@ -1305,52 +1282,28 @@ def getmeta(fn):
13051282
# ----------------------------------------------------------------------
13061283
def _output(docname, fields, outfile=sys.stdout):
13071284
global company_domain
1308-
if opt_getauthors:
1309-
# Output an (incomplete!) getauthors-compatible format.
1310-
# Information about security and iana sections presence is
1311-
# missing.
1312-
for full,first,middle,last,suffix,email,country,company in fields["_authorlist"]:
1313-
if company in company_domain:
1314-
company = company_domain[company]
1285+
1286+
if opt_attributes:
1287+
def outputkey(key, fields):
1288+
field = fields[key]
1289+
if "\n" in field:
1290+
field = "\n" + field.rstrip()
13151291
else:
1316-
if email and '@' in email:
1317-
company = email.split('@')[1]
1318-
if company.endswith(".com"):
1319-
company = company[:-4]
1320-
fields["name"] = full
1321-
fields["email"] = email
1322-
fields["company"] = company
1323-
fields["country"] = country or "UNKNOWN"
1324-
try:
1325-
year, month, day = fields["doccreationdate"].split("-")
1326-
except ValueError:
1327-
year, month, day = "UNKNOWN", "UNKNOWN", "UNKNOWN"
1328-
fields["day"] = day
1329-
fields["month"] = month_names[int(month)] if month != "UNKNOWN" else "UNKNOWN"
1330-
fields["year"] = year
1331-
print("%(doctag)s:%(name)s:%(company)s:%(email)s:%(country)s:%(docpages)s:%(month)s:%(year)s:%(day)s:" % fields)
1292+
field = field.strip()
1293+
outfile.write("%-24s: %s\n" % ( key, field.replace("\\", "\\\\" ).replace("'", "\\x27" )))
13321294
else:
1333-
if opt_attributes:
1334-
def outputkey(key, fields):
1335-
field = fields[key]
1336-
if "\n" in field:
1337-
field = "\n" + field.rstrip()
1338-
else:
1339-
field = field.strip()
1340-
outfile.write("%-24s: %s\n" % ( key, field.replace("\\", "\\\\" ).replace("'", "\\x27" )))
1341-
else:
1342-
def outputkey(key, fields):
1343-
outfile.write(" %s='%s'" % ( key.lower(), fields[key].strip().replace("\\", "\\\\" ).replace("'", "\\x27" ).replace("\n", "\\n")))
1344-
if opt_timestamp:
1345-
outfile.write("%s " % (fields["eventdate"]))
1346-
outfile.write("%s" % (os.path.basename(docname.strip())))
1347-
1348-
keys = list(fields.keys())
1349-
keys.sort()
1350-
for key in keys:
1351-
if fields[key] and not key in ["eventdate", ] and not key.startswith("_"):
1352-
outputkey(key, fields)
1353-
outfile.write("\n")
1295+
def outputkey(key, fields):
1296+
outfile.write(" %s='%s'" % ( key.lower(), fields[key].strip().replace("\\", "\\\\" ).replace("'", "\\x27" ).replace("\n", "\\n")))
1297+
if opt_timestamp:
1298+
outfile.write("%s " % (fields["eventdate"]))
1299+
outfile.write("%s" % (os.path.basename(docname.strip())))
1300+
1301+
keys = list(fields.keys())
1302+
keys.sort()
1303+
for key in keys:
1304+
if fields[key] and not key in ["eventdate", ] and not key.startswith("_"):
1305+
outputkey(key, fields)
1306+
outfile.write("\n")
13541307

13551308
# ----------------------------------------------------------------------
13561309
def _printmeta(fn, outfile=sys.stdout):
@@ -1371,7 +1324,7 @@ def _printmeta(fn, outfile=sys.stdout):
13711324

13721325
company_domain = {} # type: Dict[str, str]
13731326
def _main(outfile=sys.stdout):
1374-
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, opt_getauthors, files, company_domain, opt_attributes
1327+
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, files, company_domain, opt_attributes
13751328
# set default values, if any
13761329
# ----------------------------------------------------------------------
13771330
# Option processing
@@ -1408,8 +1361,6 @@ def _main(outfile=sys.stdout):
14081361
elif opt in ["-v", "--version"]: # Output version information, then exit
14091362
print(program, version)
14101363
sys.exit(0)
1411-
elif opt in ["--getauthors"]: # Output an (incomplete) getauthors-compatible format
1412-
opt_getauthors = True
14131364
elif opt in ["-a", "--attribs"]: # Output key-value attribute pairs
14141365
opt_attributes = True
14151366
elif opt in ["-t", ]: # Toggle leading timestamp information
@@ -1422,15 +1373,7 @@ def _main(outfile=sys.stdout):
14221373
opt_trace = True
14231374

14241375
company_domain = {}
1425-
if opt_getauthors:
1426-
gadata = io.open("/www/tools.ietf.org/tools/getauthors/getauthors.data")
1427-
for line in gadata:
1428-
if line.startswith("company:"):
1429-
try:
1430-
kword, name, abbrev = line.strip().split(':')
1431-
company_domain[name] = abbrev
1432-
except ValueError:
1433-
pass
1376+
14341377
if not files:
14351378
files = [ "-" ]
14361379

ietf/utils/xmldraft.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2021, All Rights Reserved
1+
# Copyright The IETF Trust 2022, All Rights Reserved
22
# -*- coding: utf-8 -*-
33
import os
44
import xml2rfc
@@ -7,8 +7,6 @@
77

88
from contextlib import ExitStack
99

10-
from django.conf import settings
11-
1210
from .draft import Draft
1311

1412

@@ -32,20 +30,15 @@ def __init__(self, xml_file):
3230
def parse_xml(filename):
3331
orig_write_out = xml2rfc.log.write_out
3432
orig_write_err = xml2rfc.log.write_err
35-
orig_xml_library = os.environ.get('XML_LIBRARY', None)
3633
tree = None
3734
with ExitStack() as stack:
3835
@stack.callback
3936
def cleanup(): # called when context exited, even if there's an exception
4037
xml2rfc.log.write_out = orig_write_out
4138
xml2rfc.log.write_err = orig_write_err
42-
os.environ.pop('XML_LIBRARY')
43-
if orig_xml_library is not None:
44-
os.environ['XML_LIBRARY'] = orig_xml_library
4539

4640
xml2rfc.log.write_out = open(os.devnull, 'w')
4741
xml2rfc.log.write_err = open(os.devnull, 'w')
48-
os.environ['XML_LIBRARY'] = settings.XML_LIBRARY
4942

5043
parser = xml2rfc.XmlRfcParser(filename, quiet=True)
5144
tree = parser.parse()

0 commit comments

Comments
 (0)