From: Raphael Michel Date: Wed, 18 May 2022 14:30:03 +0000 (+0200) Subject: Allow to disable validation X-Git-Tag: 2.2.0~1^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1853dddb61ef6a947134fe5ed0f3981ce4f1b107;p=thirdparty%2Fpython-drafthorse.git Allow to disable validation --- diff --git a/drafthorse/utils.py b/drafthorse/utils.py index 299e14d..913830f 100644 --- a/drafthorse/utils.py +++ b/drafthorse/utils.py @@ -33,7 +33,8 @@ def validate_xml(xmlout, schema): except ImportError: logger.warning("Could not validate output as LXML is not installed.") return xmlout - schema = etree.XMLSchema(file=os.path.join(os.path.dirname(__file__), 'schema', schema + '.xsd')) + if schema is not None: + schema = etree.XMLSchema(file=os.path.join(os.path.dirname(__file__), 'schema', schema + '.xsd')) parser = etree.XMLParser(schema=schema) xml_root = etree.fromstring(xmlout, parser) return b"" + etree.tostring(xml_root, pretty_print=True)