Skip to content

Commit faecc69

Browse files
committed
Changed the code for meta-data extraction from xml files to not break if a sought-after element is missing.
- Legacy-Id: 9922
1 parent fb79c8a commit faecc69

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

ietf/submit/forms.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def clean(self):
150150
parser = xml2rfc.XmlRfcParser(tfn, quiet=True)
151151
self.xmltree = parser.parse()
152152
ok, errors = self.xmltree.validate()
153-
debug.type('errors')
154153
if not ok:
155154
# Each error has properties:
156155
#
@@ -174,16 +173,16 @@ def clean(self):
174173
else:
175174
self.revision = None
176175
self.filename = draftname
177-
self.title = self.xmlroot.find('front/title').text
178-
self.abstract = self.xmlroot.find('front/abstract').text
176+
self.title = self.xmlroot.findtext('front/title')
177+
self.abstract = self.xmlroot.findtext('front/abstract')
179178
self.author_list = []
180179
author_info = self.xmlroot.findall('front/author')
181180
for author in author_info:
182181
author_dict = dict(
183-
company = author.find('organization').text,
182+
company = author.findtext('organization'),
184183
last_name = author.attrib.get('surname'),
185184
full_name = author.attrib.get('fullname'),
186-
email = author.find('address/email').text,
185+
email = author.findtext('address/email'),
187186
)
188187
self.author_list.append(author_dict)
189188
line = "%(full_name)s <%(email)s>" % author_dict

0 commit comments

Comments
 (0)