fixes for the merge proposal

This commit is contained in:
Andreas Preikschat 2010-10-09 21:36:05 +02:00
parent 2ad3f983f7
commit 84d0c01274
2 changed files with 10 additions and 8 deletions

View File

@ -353,8 +353,8 @@ class BibleDB(QtCore.QObject, Manager):
QtGui.QMessageBox.information(self.bible_plugin.mediaItem,
translate('BiblesPlugin.BibleDB', 'Book not found'),
translate('BiblesPlugin.BibleDB', 'The book you requested '
'could not be found in this bible. Please check your '
'spelling and that this is a complete bible not just '
'could not be found in this Bible. Please check your '
'spelling and that this is a complete Bible not just '
'one testament.'))
return verse_list
@ -369,19 +369,19 @@ class BibleDB(QtCore.QObject, Manager):
values.
"""
log.debug(u'BibleDB.verse_search("%s")', text)
verses = self.session.query(Verse)
if text.find(u',') > -1:
or_clause = []
keywords = [u'%%%s%%' % keyword.strip()
for keyword in text.split(u',')]
for keyword in keywords:
or_clause.append(Verse.text.like(keyword))
verses = self.session.query(Verse).filter(or_(*or_clause))
verses = verses.filter(or_(*or_clause))
else:
keywords = [u'%%%s%%' % keyword.strip()
for keyword in text.split(u' ')]
for keyword in keywords:
verses = self.session.query(Verse)\
.filter(Verse.text.like(keyword))
verses = verses.filter(Verse.text.like(keyword))
verses = verses.all()
return verses

View File

@ -259,11 +259,13 @@ class BibleManager(object):
def verse_search(self, bible, text):
"""
Does a verse search for the given bible and text.
``bible``
The bible to seach in.
The bible to seach in (unicode).
``text``
The text to search for.
The text to search for (unicode).
"""
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
if text:
@ -273,7 +275,7 @@ class BibleManager(object):
translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'You did not enter a '
'search keyword.\nYou can seperate different keywords by a '
'search keyword.\nYou can separate different keywords by a '
'space to search for all of your keywords and you can seperate '
'them by a comma to search for one of them.'))
return None