forked from openlp/openlp
Fix multi bible searches
bzr-revno: 53
This commit is contained in:
parent
91e388763e
commit
06ed511d67
@ -179,6 +179,11 @@ class BibleDBImpl:
|
|||||||
s = text (""" select text FROM verse,book where verse.book_id == book.id AND verse.chapter == :c and verse.verse == :v and book.name == :b """)
|
s = text (""" select text FROM verse,book where verse.book_id == book.id AND verse.chapter == :c and verse.verse == :v and book.name == :b """)
|
||||||
return self.db.execute(s, c=chapter, v=verse , b=bookname).fetchone()
|
return self.db.execute(s, c=chapter, v=verse , b=bookname).fetchone()
|
||||||
|
|
||||||
|
def getBibleText(self, bookname, chapter, sverse, everse):
|
||||||
|
metadata.bind.echo = True
|
||||||
|
s = text (""" select text FROM verse,book where verse.book_id == book.id AND verse.chapter == :c AND (verse.verse between :v1 and :v2) and book.name == :b """)
|
||||||
|
return self.db.execute(s, c=chapter, v1=sverse , v2=everse, b=bookname).fetchall()
|
||||||
|
|
||||||
def _cleanText(self, text):
|
def _cleanText(self, text):
|
||||||
text = text.replace('\n', '')
|
text = text.replace('\n', '')
|
||||||
text = text.replace('\r', '')
|
text = text.replace('\r', '')
|
||||||
|
@ -98,7 +98,8 @@ class BibleManager:
|
|||||||
then only one verse is returned
|
then only one verse is returned
|
||||||
"""
|
"""
|
||||||
if everse < sverse:
|
if everse < sverse:
|
||||||
everse = sverse # make sure end after we start. Also optional
|
text = self.biblelist[bible].getBibleText(book, chapter, sverse)
|
||||||
text = self.biblelist[bible].getBibleText(book, chapter, sverse)
|
else:
|
||||||
|
text = self.biblelist[bible].getBibleText(book, chapter, sverse, everse)
|
||||||
print text
|
print text
|
||||||
return text
|
return text
|
||||||
|
@ -62,9 +62,9 @@ class TestBibleManager(unittest.TestCase):
|
|||||||
|
|
||||||
def testGetVerseText(self):
|
def testGetVerseText(self):
|
||||||
print "testGetVerseText"
|
print "testGetVerseText"
|
||||||
c = self.bm.getVerseText("TheMessage",'"Genesis"',1,2,1)
|
c = self.bm.getVerseText("TheMessage",'Genesis',1,1,1)
|
||||||
print c
|
print c
|
||||||
c = self.bm.getVerseText("NIV",'"Genesis"',1,2,1)
|
c = self.bm.getVerseText("NIV",'Genesis',1,1,3)
|
||||||
print c
|
print c
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user