openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #28553
[Merge] lp:~raoul-snyman/openlp/fix-bs4-warning into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/fix-bs4-warning into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/fix-bs4-warning/+merge/285112
Fix up some warnings we get about BeautifulSoup's parser.
--
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/fix-bs4-warning into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2015-12-31 22:46:06 +0000
+++ openlp/plugins/bibles/lib/http.py 2016-02-04 20:34:49 +0000
@@ -288,7 +288,7 @@
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 @@
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.')
=== modified file 'tests/functional/openlp_plugins/bibles/test_http.py'
--- tests/functional/openlp_plugins/bibles/test_http.py 2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_plugins/bibles/test_http.py 2016-02-04 20:34:49 +0000
@@ -152,7 +152,7 @@
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()
Follow ups