← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~orangeshirt/openlp/bibles_fixes into lp:openlp

 

Armin Köhler has proposed merging lp:~orangeshirt/openlp/bibles_fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~orangeshirt/openlp/bibles_fixes/+merge/62947

Fixes problems with unicode book names on Biblegateway
Fixes download problem with first verse on Biblegateway
remove unnecessary whitespace
-- 
https://code.launchpad.net/~orangeshirt/openlp/bibles_fixes/+merge/62947
Your team OpenLP Core is requested to review the proposed merge of lp:~orangeshirt/openlp/bibles_fixes into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2011-05-26 20:41:19 +0000
+++ openlp/plugins/bibles/lib/http.py	2011-05-31 07:34:25 +0000
@@ -72,9 +72,8 @@
         log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, 
             bookname, chapter)
         urlbookname = urllib.quote(bookname.encode("utf-8"))
-        url_params = urllib.urlencode(
-            {u'search': u'%s %s' % (urlbookname, chapter),
-            u'version': u'%s' % version})
+        url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter, 
+            version)
         cleaner = [(re.compile('&nbsp;|<br />|\'\+\''), lambda match: '')]
         soup = get_soup_for_bible_ref(
             u'http://www.biblegateway.com/passage/?%s' % url_params,
@@ -97,10 +96,10 @@
         verse_list = {}
         # Cater for inconsistent mark up in the first verse of a chapter.
         first_verse = verses.find(u'versenum')
-        if first_verse:
+        if first_verse and len(first_verse.contents):
             verse_list[1] = unicode(first_verse.contents[0])
         for verse in verses(u'sup', u'versenum'):
-            raw_verse_num =  verse.next
+            raw_verse_num = verse.next
             clean_verse_num = 0
             # Not all verses exist in all translations and may or may not be
             # represented by a verse number. If they are not fine, if they are


Follow ups