- small clean ups

bzr-revno: 1464
This commit is contained in:
Andreas Preikschat 2011-04-15 08:08:29 +02:00
commit 39f1e791d8

View File

@ -177,10 +177,7 @@ class BibleDB(QtCore.QObject, Manager):
Returns the version name of the Bible.
"""
version_name = self.get_object(BibleMeta, u'Version')
if version_name:
self.name = version_name.value
else:
self.name = None
self.name = version_name.value if version_name else None
return self.name
def clean_filename(self, old_filename):
@ -383,15 +380,13 @@ class BibleDB(QtCore.QObject, Manager):
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))
keywords = \
[u'%%%s%%' % keyword.strip() for keyword in text.split(u',')]
or_clause = [Verse.text.like(keyword) for keyword in keywords]
verses = verses.filter(or_(*or_clause))
else:
keywords = [u'%%%s%%' % keyword.strip()
for keyword in text.split(u' ')]
keywords = \
[u'%%%s%%' % keyword.strip() for keyword in text.split(u' ')]
for keyword in keywords:
verses = verses.filter(Verse.text.like(keyword))
verses = verses.all()