When searching for 'John 99' etc. an exception was triggered. The code in get_webbible is changed accordingly, even no exception can be risen with the current code.

bzr-revno: 1804
This commit is contained in:
Meinert Jordan 2011-11-26 22:21:16 +02:00 committed by Raoul Snyman
commit 331e596a96
2 changed files with 6 additions and 4 deletions

View File

@ -39,6 +39,8 @@ class Ui_ExceptionDialog(object):
self.messageLayout.addSpacing(12) self.messageLayout.addSpacing(12)
self.bugLabel = QtGui.QLabel(exceptionDialog) self.bugLabel = QtGui.QLabel(exceptionDialog)
self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png')) self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
self.bugLabel.setSizePolicy(QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
self.bugLabel.setObjectName(u'bugLabel') self.bugLabel.setObjectName(u'bugLabel')
self.messageLayout.addWidget(self.bugLabel) self.messageLayout.addWidget(self.bugLabel)
self.messageLayout.addSpacing(12) self.messageLayout.addSpacing(12)

View File

@ -638,14 +638,14 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, ' chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, '
u'chapter, verse_count FROM chapters WHERE book_reference_id = ?', u'chapter, verse_count FROM chapters WHERE book_reference_id = ?',
(book_id,)) (book_id,))
if chapters: try:
return { return {
u'id': chapters[chapter-1][0], u'id': chapters[chapter-1][0],
u'book_reference_id': chapters[chapter-1][1], u'book_reference_id': chapters[chapter-1][1],
u'chapter': chapters[chapter-1][2], u'chapter': chapters[chapter-1][2],
u'verse_count': chapters[chapter-1][3] u'verse_count': chapters[chapter-1][3]
} }
else: except (IndexError, TypeError):
return None return None
@staticmethod @staticmethod
@ -753,7 +753,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
u'language_id, download_source_id FROM webbibles WHERE ' u'language_id, download_source_id FROM webbibles WHERE '
u'download_source_id = ? AND abbreviation = ?', (source[u'id'], u'download_source_id = ? AND abbreviation = ?', (source[u'id'],
abbreviation)) abbreviation))
if bible: try:
return { return {
u'id': bible[0][0], u'id': bible[0][0],
u'name': bible[0][1], u'name': bible[0][1],
@ -761,7 +761,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
u'language_id': bible[0][3], u'language_id': bible[0][3],
u'download_source_id': bible[0][4] u'download_source_id': bible[0][4]
} }
else: except (IndexError, TypeError):
return None return None
@staticmethod @staticmethod