forked from openlp/openlp
"Fix up some warnings we get about BeautifulSoup's parser."
bzr-revno: 2613
This commit is contained in:
commit
022261dbd1
@ -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.')
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user