← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bible-language-fix into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bible-language-fix into lp:openlp.

Requested reviews:
  Andreas Preikschat (googol)
  Tim Bentley (trb143)
Related bugs:
  Bug #997174 in OpenLP: "Webbible search causes traceback"
  https://bugs.launchpad.net/openlp/+bug/997174

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bible-language-fix/+merge/106021

Fixed a super-annoying bug where any newly imported Bibles would throw an exception.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bible-language-fix/+merge/106021
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2012-04-22 18:19:36 +0000
+++ openlp/plugins/bibles/lib/manager.py	2012-05-16 16:55:22 +0000
@@ -330,13 +330,7 @@
                     'Import Wizard to install one or more Bibles.')
                     })
             return None
-        language_selection = self.get_meta_data(bible, u'book_name_language')
-        if language_selection:
-            language_selection = int(language_selection.value)
-        if language_selection is None or language_selection == -1:
-            language_selection = QtCore.QSettings().value(
-                self.settingsSection + u'/bookname language',
-                QtCore.QVariant(0)).toInt()[0]
+        language_selection = self.get_language_selection(bible)
         reflist = parse_reference(versetext, self.db_cache[bible],
             language_selection, book_ref_id)
         if reflist:
@@ -378,12 +372,16 @@
         """
         log.debug(u'BibleManager.get_language_selection("%s")', bible)
         language_selection = self.get_meta_data(bible, u'book_name_language')
-        if language_selection and language_selection.value != u'None':
-            return int(language_selection.value)
-        if language_selection is None or  language_selection.value == u'None':
-            return QtCore.QSettings().value(
+        if language_selection:
+            try:
+                language_selection = int(language_selection.value)
+            except (ValueError, TypeError):
+                language_selection = LanguageSelection.Application
+        if language_selection is None or language_selection == -1:
+            language_selection = QtCore.QSettings().value(
                 self.settingsSection + u'/bookname language',
                 QtCore.QVariant(0)).toInt()[0]
+        return language_selection
 
     def verse_search(self, bible, second_bible, text):
         """

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2012-05-01 11:28:49 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2012-05-16 16:55:22 +0000
@@ -843,10 +843,11 @@
         items = []
         language_selection = self.plugin.manager.get_language_selection(bible)
         for count, verse in enumerate(search_results):
+            book = None
             if language_selection == LanguageSelection.Bible:
                 book = verse.book.name
             elif language_selection == LanguageSelection.Application:
-                book_names = BibleStrings().Booknames
+                book_names = BibleStrings().BookNames
                 data = BiblesResourcesDB.get_book_by_id(
                 verse.book.book_reference_id)
                 book = unicode(book_names[data[u'abbreviation']])


Follow ups