| 1 |
From: Bastian Germann <[email protected]> |
| 2 |
Date: Sat, 3 Jun 2023 15:48:32 +0200 |
| 3 |
Forwarded: not-needed |
| 4 |
Subject: Change validation defaults |
| 5 |
|
| 6 |
Do not validate by default and change the schema location to a /etc place. |
| 7 |
The upstream schemas cannot be distributed in Debian main. |
| 8 |
--- |
| 9 |
sepaxml/shared.py | 2 +- |
| 10 |
sepaxml/validation.py | 2 +- |
| 11 |
2 files changed, 2 insertions(+), 2 deletions(-) |
| 12 |
|
| 13 |
diff --git a/sepaxml/shared.py b/sepaxml/shared.py |
| 14 |
index 251698b..3f3ad78 100644 |
| 15 |
--- a/sepaxml/shared.py |
| 16 |
+++ b/sepaxml/shared.py |
| 17 |
@@ -55,7 +55,7 @@ class SepaPaymentInitn: |
| 18 |
def _finalize_batch(self): |
| 19 |
raise NotImplementedError() |
| 20 |
|
| 21 |
- def export(self, validate=True, pretty_print=False): |
| 22 |
+ def export(self, validate=False, pretty_print=False): |
| 23 |
""" |
| 24 |
Method to output the xml as string. It will finalize the batches and |
| 25 |
then calculate the checksums (amount sum and transaction count), |
| 26 |
diff --git a/sepaxml/validation.py b/sepaxml/validation.py |
| 27 |
index b3f8ba1..050bc61 100644 |
| 28 |
--- a/sepaxml/validation.py |
| 29 |
+++ b/sepaxml/validation.py |
| 30 |
@@ -8,7 +8,7 @@ class ValidationError(Exception): |
| 31 |
def try_valid_xml(xmlout, schema): |
| 32 |
import xmlschema # xmlschema does some weird monkeypatching in etree, if we import it globally, things fail |
| 33 |
try: |
| 34 |
- my_schema = xmlschema.XMLSchema(os.path.join(os.path.dirname(__file__), 'schemas', schema + '.xsd')) |
| 35 |
+ my_schema = xmlschema.XMLSchema(os.path.join('/etc/python-sepaxml/schemas', schema + '.xsd')) |
| 36 |
my_schema.validate(xmlout.decode()) |
| 37 |
|
| 38 |
except xmlschema.XMLSchemaValidationError as e: |