"Fix up some warnings we get about BeautifulSoup's parser."

bzr-revno: 2613
This commit is contained in:
raoul@snyman.info 2016-02-05 21:55:30 +02:00 committed by Raoul Snyman
commit 022261dbd1
2 changed files with 3 additions and 3 deletions

View File

@ -288,7 +288,7 @@ class BGExtract(RegistryProperties):
except UnicodeDecodeError:
page_source = str(page_source, 'cp1251')
try:
soup = BeautifulSoup(page_source)
soup = BeautifulSoup(page_source, 'lxml')
except Exception:
log.error('BeautifulSoup could not parse the Bible page.')
send_error_message('parse')
@ -759,7 +759,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre
page_source = re.sub(pre_parse_regex, pre_parse_substitute, page_source.decode())
soup = None
try:
soup = BeautifulSoup(page_source)
soup = BeautifulSoup(page_source, 'lxml')
CLEANER_REGEX.sub('', str(soup))
except Exception:
log.exception('BeautifulSoup could not parse the bible page.')

View File

@ -152,7 +152,7 @@ class TestBSExtract(TestCase):
self.test_html = '<ul><li><a href="/overlay/selectChapter?tocBook=1">Genesis</a></li>' \
'<li><a href="/overlay/selectChapter?tocBook=2"></a></li>' \
'<li><a href="/overlay/selectChapter?tocBook=3">Leviticus</a></li></ul>'
self.test_soup = BeautifulSoup(self.test_html)
self.test_soup = BeautifulSoup(self.test_html, 'lxml')
instance = BSExtract()
self.mock_log.reset_mock()
self.mock_urllib.reset_mock()