Temorary workaround to upload xml validation. The tree.validate() of xml2rfc should be updated to check vocabulary version and validate against the appropriate schema, to fix this properly.

- Legacy-Id: 16101
This commit is contained in:
Henrik Levkowetz 2019-03-25 10:56:30 +00:00
parent a60ac983d7
commit 2f31f7fb88

View file

@ -146,7 +146,14 @@ class SubmissionBaseUploadForm(forms.Form):
try:
parser = xml2rfc.XmlRfcParser(str(tfn), quiet=True)
self.xmltree = parser.parse(normalize=True)
ok, errors = self.xmltree.validate()
root = self.xmltree.getroot()
ver = root.get('version', '2')
debug.show('ver')
if ver == '2':
ok, errors = self.xmltree.validate()
else:
# XXX TODO: Add v3 validation
ok, errors = True, ''
except Exception as exc:
raise forms.ValidationError("An exception occurred when trying to process the XML file: %s" % exc)
if not ok: