From 44a726cd69e3e0d5c50890946b366c441a575a37 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Sat, 21 Jul 2007 22:13:06 +0000 Subject: added logviewers --- portato.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'portato.py') diff --git a/portato.py b/portato.py index 5e8b30a..736d2f3 100755 --- a/portato.py +++ b/portato.py @@ -67,12 +67,17 @@ def main (): show_ebuild(options.ebuild) elif options.validate: from lxml import etree - if etree.XMLSchema(file = XSD_LOCATION).validate(etree.parse(options.validate)): - print "Passed validation." - return - else: - print "Verification failed." + try: + etree.XMLSchema(file = XSD_LOCATION).assertValid(etree.parse(options.validate)) + except etree.XMLSyntaxError, e: + print "Verification failed. XML syntax error: %s." % e[0] + sys.exit(3) + except etree.DocumentInvalid: + print "Verification failed. Does not comply with schema." sys.exit(3) + else: + print "Verification succeeded." + return else: run() -- cgit v1.2.3