]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Allow to disable validation
authorRaphael Michel <mail@raphaelmichel.de>
Wed, 18 May 2022 14:30:03 +0000 (16:30 +0200)
committerRaphael Michel <mail@raphaelmichel.de>
Wed, 18 May 2022 14:30:03 +0000 (16:30 +0200)
drafthorse/utils.py

index 299e14d89ab8e933ee0f4c3b87e51f4a9076eaec..913830f8265f391250c99cdf2ebd3b0d6e0411d7 100644 (file)
@@ -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"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + etree.tostring(xml_root, pretty_print=True)