Skip to content

Commit

Permalink
Show lxml warning only in verbose 3 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Aug 12, 2018
1 parent f9e84c7 commit f633ba5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wsgidav/server/server_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ def run():
)
)

if not use_lxml: # and config["verbose"] >= 1:
if not use_lxml and config["verbose"] >= 3:
_logger.warn(
"Could not import lxml: using xml instead (slower). "
"Consider installing lxml https://pypi.python.org/pypi/lxml."
"Could not import lxml: using xml instead (up to 10% slower). "
"Consider `pip install lxml`(see https://pypi.python.org/pypi/lxml)."
)

handler(app, config, server)
Expand Down
1 change: 1 addition & 0 deletions wsgidav/xml_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use_lxml = True
_ElementType = etree._Element
except ImportError:
# warnings.warn("Could not import lxml") # , ImportWarning)
# Try xml module (Python 2.5 or later) with safe defaults
from defusedxml import ElementTree as etree

Expand Down

0 comments on commit f633ba5

Please sign in to comment.