Improve bibleserver code resiliance

This commit is contained in:
Jon Tibble 2011-01-12 15:31:32 +00:00
parent e6ae8d16cb
commit 64367909ba

View File

@ -269,11 +269,12 @@ class BSExtract(object):
if not soup: if not soup:
return None return None
Receiver.send_message(u'openlp_process_events') 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: if not content:
log.exception(u'No verses found in the Bibleserver response.') log.exception(u'No verses found in the Bibleserver response.')
send_error_message(u'parse') send_error_message(u'parse')
return None return None
content = content.find(u'div').findAll(u'div')
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse') verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse')
verses = {} verses = {}
for verse in content: for verse in content: