From 73ad78e3ad5cec629fbdf287075da74a8fa65077 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Fri, 20 Jul 2012 20:25:55 +0100 Subject: [PATCH 1/2] 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 From e1cc13d54d8c0f574d4b8f499dc0a24e0686c288 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Sat, 21 Jul 2012 22:32:04 +0100 Subject: [PATCH 2/2] Changed bible to Bible --- openlp/plugins/bibles/lib/opensong.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 4d8ef0ede..b31064596 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -117,12 +117,12 @@ class OpenSongBible(BibleDB): except etree.XMLSyntaxError as inst: critical_error_message_box( message=translate('BiblesPlugin.OpenSongImport', - 'Incorrect bible file type supplied. OpenSong bibles may be ' + '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') + log.exception(u'Loading Bible from OpenSong file failed') success = False finally: if file: