markup: allow better lxml import failure detection.
- in some conditions previous syntaxt could cause errors in first import.
This commit is contained in:
parent
b98b5eaaa8
commit
ff01b29445
1 changed files with 7 additions and 0 deletions
|
|
@ -77,6 +77,13 @@ def relative_links(html_source, server_path):
|
|||
if not html_source:
|
||||
return html_source
|
||||
|
||||
try:
|
||||
from lxml.html import fromstring
|
||||
from lxml.html import tostring
|
||||
except ImportError:
|
||||
log.exception('Failed to import lxml')
|
||||
return html_source
|
||||
|
||||
try:
|
||||
doc = lxml.html.fromstring(html_source)
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue