summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-29 12:21:19 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-29 12:21:19 +0200
commit8655204192bacf94c2046ba030f6c090750bbc5a (patch)
tree88926fa0ffade102cb7a5b95cf919242c8c5da36
parentaf0882d8f0635c5c402cce98e01079979c341731 (diff)
downloadxdd2esi-8655204192bacf94c2046ba030f6c090750bbc5a.tar.gz
xdd2esi-8655204192bacf94c2046ba030f6c090750bbc5a.zip
Shrink validation output by using "prev. msg. repeated"
-rw-r--r--esilib.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/esilib.py b/esilib.py
index c890790..f52ee6d 100644
--- a/esilib.py
+++ b/esilib.py
@@ -104,7 +104,19 @@ class ESIFile:
else:
if not xmlschema.validate(self.dicttree):
error = xmlschema.error_log
- logging.error("Validation failed!\n" + str(error))
+ logging.error("Validation failed!\n")
+ prevmsg = None
+ rcnt = 0
+ for message in error:
+ if str(prevmsg) == str(message):
+ rcnt += 1
+ else:
+ if rcnt != 0:
+ print("=== Previous message repated {} times "
+ "===".format(rcnt))
+ rcnt = 0
+ print(message)
+ prevmsg = message
warnings.warn("The output is not a valid ESI!",
InvalidESIWarning)