# HG changeset patch # User Marcin Kuzminski # Date 2017-08-03 22:18:59 # Node ID 1ea54f1f6ea7cc8ba4d312fe088653baeec7927c # Parent 844b6602da1aa2295279df215c2467d18e4541f5 markup: allow better lxml import failure detection. - in some conditions previous syntaxt could cause errors in first import. diff --git a/rhodecode/lib/markup_renderer.py b/rhodecode/lib/markup_renderer.py --- a/rhodecode/lib/markup_renderer.py +++ b/rhodecode/lib/markup_renderer.py @@ -78,6 +78,13 @@ def relative_links(html_source, server_p 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: return html_source