Files
edx-platform/common/lib/xmodule/xmodule/html_checker.py
Maxim Dorovkov 8702e40589 INCR-230 - Run python-modernize and isort on common/lib/xmodule/xmodule (#20506)
* INCR-230 - Run python-modernize and isort on common/lib/xmodule/xmodule, plus a few minor fixes suggested by Jeremy
2019-05-16 10:09:15 -04:00

18 lines
380 B
Python

from __future__ import absolute_import
from lxml import etree
def check_html(html):
'''
Check whether the passed in html string can be parsed by lxml.
Return bool success.
'''
parser = etree.HTMLParser()
try:
etree.fromstring(html, parser)
return True
except Exception: # pylint: disable=broad-except
pass
return False