← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/bibles into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/bibles into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/bibles/+merge/61018

Hello,

- fixed a traceback which occurred when performing a text search but no bible is available
-- 
https://code.launchpad.net/~googol-hush/openlp/bibles/+merge/61018
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/bibles into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2011-04-13 18:53:05 +0000
+++ openlp/plugins/bibles/lib/db.py	2011-05-15 13:14:23 +0000
@@ -401,7 +401,7 @@
         """
         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 @@
         """
         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

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2011-03-24 19:04:02 +0000
+++ openlp/plugins/bibles/lib/manager.py	2011-05-15 13:14:23 +0000
@@ -285,7 +285,7 @@
         Does a verse search for the given bible and text.
 
         ``bible``
-            The bible to seach in (unicode).
+            The bible to search in (unicode).
 
         ``second_bible``
             The second bible (unicode). We do not search in this bible.
@@ -294,6 +294,15 @@
             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')


Follow ups