From 73ad78e3ad5cec629fbdf287075da74a8fa65077 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Fri, 20 Jul 2012 20:25:55 +0100 Subject: [PATCH] Fix for bug:1020915 OpenSong Bible import has uncaught exception on non-xml file --- openlp/plugins/bibles/lib/opensong.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 706d6d451..4d8ef0ede 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -27,9 +27,10 @@ ############################################################################### import logging -from lxml import objectify +from lxml import etree, objectify from openlp.core.lib import Receiver, translate +from openlp.core.lib.ui import critical_error_message_box from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB log = logging.getLogger(__name__) @@ -113,6 +114,13 @@ class OpenSongBible(BibleDB): (db_book.name, int(chapter.attrib[u'n'].split()[-1]))) self.session.commit() Receiver.send_message(u'openlp_process_events') + except etree.XMLSyntaxError as inst: + critical_error_message_box( + message=translate('BiblesPlugin.OpenSongImport', + 'Incorrect bible file type supplied. OpenSong bibles may be ' + 'compressed. You must decompress them before import.')) + log.exception(inst) + success = False except (IOError, AttributeError): log.exception(u'Loading bible from OpenSong file failed') success = False