From ff01b294451e25b4c1a43397e47c71593b217576 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Fri, 4 Aug 2017 00:18:59 +0200 Subject: [PATCH] markup: allow better lxml import failure detection. - in some conditions previous syntaxt could cause errors in first import. --- rhodecode/lib/markup_renderer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rhodecode/lib/markup_renderer.py b/rhodecode/lib/markup_renderer.py index e37f362b..5b2a1773 100644 --- a/rhodecode/lib/markup_renderer.py +++ b/rhodecode/lib/markup_renderer.py @@ -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: