From 64367909ba07a7c13a74e4217b52698f9904f680 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 12 Jan 2011 15:31:32 +0000 Subject: [PATCH 1/2] Improve bibleserver code resiliance --- openlp/plugins/bibles/lib/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 2476ae65d..e7beeda29 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -269,11 +269,12 @@ class BSExtract(object): if not soup: return None Receiver.send_message(u'openlp_process_events') - content = soup.find(u'div', u'content').find(u'div').findAll(u'div') + content = soup.find(u'div', u'content') if not content: log.exception(u'No verses found in the Bibleserver response.') send_error_message(u'parse') return None + content = content.find(u'div').findAll(u'div') verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse') verses = {} for verse in content: From 0a5b44c6a35588bba808d0bd28716c916f44d58c Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 12 Jan 2011 19:12:30 +0000 Subject: [PATCH 2/2] BibleGateway fix --- openlp/plugins/bibles/lib/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index e7beeda29..da3a1e9e5 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -208,7 +208,8 @@ class BGExtract(object): u'version': u'%s' % version}) cleaner = [(re.compile(' |
|\'\+\''), lambda match: '')] soup = get_soup_for_bible_ref( - u'http://www.biblegateway.com/passage/?%s' % url_params, cleaner) + u'http://www.biblegateway.com/passage/?%s' % url_params, + cleaner=cleaner) if not soup: return None Receiver.send_message(u'openlp_process_events')