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
6 changes: 3 additions & 3 deletions ietf/ipr/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007-2020, All Rights Reserved
# Copyright The IETF Trust 2007-2022, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -460,7 +460,7 @@ def by_draft_txt(request):

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

Expand Down Expand Up @@ -856,4 +856,4 @@ def update(request, id):
ipr = get_object_or_404(IprDisclosureBase,id=id)
child = ipr.get_child()
type = class_to_type[child.__class__.__name__]
return new(request, type, updates=id)
return new(request, type, updates=id)
2 changes: 0 additions & 2 deletions ietf/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,6 @@ def floorplan_url(self):
mtg_num = self.meeting.get_number()
if not mtg_num:
return None
elif mtg_num <= settings.FLOORPLAN_LAST_LEGACY_MEETING:
base_url = settings.FLOORPLAN_LEGACY_BASE_URL.format(meeting=self.meeting)
elif self.floorplan:
base_url = urlreverse('ietf.meeting.views.floor_plan', kwargs=dict(num=mtg_num))
else:
Expand Down
9 changes: 3 additions & 6 deletions ietf/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007-2020, All Rights Reserved
# Copyright The IETF Trust 2007-2022, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -73,7 +73,7 @@

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

MANAGERS = ADMINS

Expand Down Expand Up @@ -539,7 +539,6 @@ def skip_unreadable_post(record):
IDTRACKER_BASE_URL = "https://datatracker.ietf.org"
RFCDIFF_BASE_URL = "https://www.ietf.org/rfcdiff"
IDNITS_BASE_URL = "https://www.ietf.org/tools/idnits"
XML2RFC_BASE_URL = "https://xml2rfc.tools.ietf.org/experimental.html"
Comment thread
rjsparks marked this conversation as resolved.

# The name of the method to use to invoke the test suite
TEST_RUNNER = 'ietf.utils.test_runner.IetfTestRunner'
Expand Down Expand Up @@ -867,7 +866,6 @@ def skip_unreadable_post(record):
IDSUBMIT_MAX_DAILY_SUBMISSIONS = 1000
IDSUBMIT_MAX_DAILY_SUBMISSIONS_SIZE = 2000 # in MB

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

# === Meeting Related Settings =================================================

Expand Down Expand Up @@ -961,8 +959,7 @@ def skip_unreadable_post(record):

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


MEETING_USES_CODIMD_DATE = datetime.date(2020,7,6)
MEETING_LEGACY_OFFICE_HOURS_END = 112 # last meeting to use legacy office hours representation
Expand Down
5 changes: 2 additions & 3 deletions ietf/submit/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2011-2020, All Rights Reserved
# Copyright The IETF Trust 2011-2022, All Rights Reserved
# -*- coding: utf-8 -*-


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

parser = xml2rfc.XmlRfcParser(str(tfn), quiet=True)
# --- Parse the xml ---
Expand Down Expand Up @@ -668,4 +667,4 @@ def __init__(self, *args, **kwargs):
super(MessageModelForm, self).__init__(*args, **kwargs)
self.fields['frm'].label='From'
self.fields['frm'].widget.attrs['readonly'] = True
self.fields['reply_to'].widget.attrs['readonly'] = True
self.fields['reply_to'].widget.attrs['readonly'] = True
103 changes: 23 additions & 80 deletions ietf/utils/draft.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
# Copyright The IETF Trust 2009-2021, All Rights Reserved
# Copyright The IETF Trust 2009-2022, All Rights Reserved
# -*- coding: utf-8 -*-
# -*- python -*-

Expand Down Expand Up @@ -63,7 +63,6 @@
opt_timestamp = False
opt_trace = False
opt_authorinfo = False
opt_getauthors = False
opt_attributes = False
# Don't forget to add the option variable to the globals list in _main below

Expand Down Expand Up @@ -1243,28 +1242,6 @@ def getmeta(fn):
filename = fn
fn = os.path.basename(fn)
else:
if fn.lower().startswith('rfc'):
filename = os.path.join("/www/tools.ietf.org/rfc", fn)
elif not "/" in fn:
filename = os.path.join("/www/tools.ietf.org/id", fn)
if not os.path.exists(filename):
fn = filename
while not "-00." in fn:
revmatch = re.search(r"-(\d\d)\.", fn)
if revmatch:
rev = revmatch.group(1)
prev = "%02d" % (int(rev)-1)
fn = fn.replace("-%s."%rev, "-%s."%prev)
if os.path.exists(fn):
_warn("Using rev %s instead: '%s'" % (prev, filename))
filename = fn
fn = os.path.basename(fn)
break
else:
break
else:
filename = fn
if not os.path.exists(filename):
_warn("Could not find file: '%s'" % (filename))
return

Expand Down Expand Up @@ -1305,52 +1282,28 @@ def getmeta(fn):
# ----------------------------------------------------------------------
def _output(docname, fields, outfile=sys.stdout):
global company_domain
if opt_getauthors:
# Output an (incomplete!) getauthors-compatible format.
# Information about security and iana sections presence is
# missing.
for full,first,middle,last,suffix,email,country,company in fields["_authorlist"]:
if company in company_domain:
company = company_domain[company]

if opt_attributes:
def outputkey(key, fields):
field = fields[key]
if "\n" in field:
field = "\n" + field.rstrip()
else:
if email and '@' in email:
company = email.split('@')[1]
if company.endswith(".com"):
company = company[:-4]
fields["name"] = full
fields["email"] = email
fields["company"] = company
fields["country"] = country or "UNKNOWN"
try:
year, month, day = fields["doccreationdate"].split("-")
except ValueError:
year, month, day = "UNKNOWN", "UNKNOWN", "UNKNOWN"
fields["day"] = day
fields["month"] = month_names[int(month)] if month != "UNKNOWN" else "UNKNOWN"
fields["year"] = year
print("%(doctag)s:%(name)s:%(company)s:%(email)s:%(country)s:%(docpages)s:%(month)s:%(year)s:%(day)s:" % fields)
field = field.strip()
outfile.write("%-24s: %s\n" % ( key, field.replace("\\", "\\\\" ).replace("'", "\\x27" )))
else:
if opt_attributes:
def outputkey(key, fields):
field = fields[key]
if "\n" in field:
field = "\n" + field.rstrip()
else:
field = field.strip()
outfile.write("%-24s: %s\n" % ( key, field.replace("\\", "\\\\" ).replace("'", "\\x27" )))
else:
def outputkey(key, fields):
outfile.write(" %s='%s'" % ( key.lower(), fields[key].strip().replace("\\", "\\\\" ).replace("'", "\\x27" ).replace("\n", "\\n")))
if opt_timestamp:
outfile.write("%s " % (fields["eventdate"]))
outfile.write("%s" % (os.path.basename(docname.strip())))

keys = list(fields.keys())
keys.sort()
for key in keys:
if fields[key] and not key in ["eventdate", ] and not key.startswith("_"):
outputkey(key, fields)
outfile.write("\n")
def outputkey(key, fields):
outfile.write(" %s='%s'" % ( key.lower(), fields[key].strip().replace("\\", "\\\\" ).replace("'", "\\x27" ).replace("\n", "\\n")))
if opt_timestamp:
outfile.write("%s " % (fields["eventdate"]))
outfile.write("%s" % (os.path.basename(docname.strip())))

keys = list(fields.keys())
keys.sort()
for key in keys:
if fields[key] and not key in ["eventdate", ] and not key.startswith("_"):
outputkey(key, fields)
outfile.write("\n")

# ----------------------------------------------------------------------
def _printmeta(fn, outfile=sys.stdout):
Expand All @@ -1371,7 +1324,7 @@ def _printmeta(fn, outfile=sys.stdout):

company_domain = {} # type: Dict[str, str]
def _main(outfile=sys.stdout):
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, opt_getauthors, files, company_domain, opt_attributes
global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, files, company_domain, opt_attributes
# set default values, if any
# ----------------------------------------------------------------------
# Option processing
Expand Down Expand Up @@ -1408,8 +1361,6 @@ def _main(outfile=sys.stdout):
elif opt in ["-v", "--version"]: # Output version information, then exit
print(program, version)
sys.exit(0)
elif opt in ["--getauthors"]: # Output an (incomplete) getauthors-compatible format
opt_getauthors = True
elif opt in ["-a", "--attribs"]: # Output key-value attribute pairs
opt_attributes = True
elif opt in ["-t", ]: # Toggle leading timestamp information
Expand All @@ -1422,15 +1373,7 @@ def _main(outfile=sys.stdout):
opt_trace = True

company_domain = {}
if opt_getauthors:
gadata = io.open("/www/tools.ietf.org/tools/getauthors/getauthors.data")
for line in gadata:
if line.startswith("company:"):
try:
kword, name, abbrev = line.strip().split(':')
company_domain[name] = abbrev
except ValueError:
pass

if not files:
files = [ "-" ]

Expand Down
9 changes: 1 addition & 8 deletions ietf/utils/xmldraft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2021, All Rights Reserved
# Copyright The IETF Trust 2022, All Rights Reserved
# -*- coding: utf-8 -*-
import os
import xml2rfc
Expand All @@ -7,8 +7,6 @@

from contextlib import ExitStack

from django.conf import settings

from .draft import Draft


Expand All @@ -32,20 +30,15 @@ def __init__(self, xml_file):
def parse_xml(filename):
orig_write_out = xml2rfc.log.write_out
orig_write_err = xml2rfc.log.write_err
orig_xml_library = os.environ.get('XML_LIBRARY', None)
tree = None
with ExitStack() as stack:
@stack.callback
def cleanup(): # called when context exited, even if there's an exception
xml2rfc.log.write_out = orig_write_out
xml2rfc.log.write_err = orig_write_err
os.environ.pop('XML_LIBRARY')
if orig_xml_library is not None:
os.environ['XML_LIBRARY'] = orig_xml_library

xml2rfc.log.write_out = open(os.devnull, 'w')
xml2rfc.log.write_err = open(os.devnull, 'w')
os.environ['XML_LIBRARY'] = settings.XML_LIBRARY

parser = xml2rfc.XmlRfcParser(filename, quiet=True)
tree = parser.parse()
Expand Down