From a2db0a1b5dbafb159b836c9c14ca7af82e7d4304 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 15 May 2011 15:06:16 +0200 Subject: [PATCH] fixed traceback when doing a text search without bible --- openlp/plugins/bibles/lib/db.py | 6 +++--- openlp/plugins/bibles/lib/manager.py | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index ec63dc02f..028a2867b 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -401,7 +401,7 @@ class BibleDB(QtCore.QObject, Manager): """ log.debug(u'BibleDB.get_chapter_count("%s")', book) count = self.session.query(Verse.chapter).join(Book)\ - .filter(Book.name==book)\ + .filter(Book.name == book)\ .distinct().count() if not count: return 0 @@ -420,8 +420,8 @@ class BibleDB(QtCore.QObject, Manager): """ log.debug(u'BibleDB.get_verse_count("%s", %s)', book, chapter) count = self.session.query(Verse).join(Book)\ - .filter(Book.name==book)\ - .filter(Verse.chapter==chapter)\ + .filter(Book.name == book)\ + .filter(Verse.chapter == chapter)\ .count() if not count: return 0 diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 67469e063..11d78a163 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -294,6 +294,15 @@ class BibleManager(object): The text to search for (unicode). """ log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text) + if not bible: + Receiver.send_message(u'openlp_information_message', { + u'title': translate('BiblesPlugin.BibleManager', + 'No Bibles Available'), + u'message': translate('BiblesPlugin.BibleManager', + 'There are no Bibles currently installed. Please use the ' + 'Import Wizard to install one or more Bibles.') + }) + return None # Check if the bible or second_bible is a web bible. webbible = self.db_cache[bible].get_object(BibleMeta, u'download source')