26d2baa983a9

Don't completely break unrelated hg commands when markdown can't be loaded.
[view raw] [browse files]
author Chris Eldredge <celdredge@fool.com>
date Mon, 07 Oct 2013 17:21:49 +0100
parents ade5266185db
children 61b435d17646
branches/tags (none)
files __init__.py

Changes

--- a/__init__.py	Sun Oct 06 17:36:21 2013 +0700
+++ b/__init__.py	Mon Oct 07 17:21:49 2013 +0100
@@ -196,11 +196,13 @@
 
     try:
         from markdown import Markdown
-        global Markdown
     except ImportError:
         dir = os.path.dirname(os.path.realpath(__file__))
         md = ui.config("web", "markdown.egg", "Markdown-2.3.1")
         ui.debug("Markdown not found search for egg in local dir %s for %s.zip\n" % (dir, md))
         sys.path.append(os.path.join(dir, "%s.zip\%s" % (md, md)))
-        from markdown import Markdown
-        global Markdown
+        try:
+            from markdown import Markdown
+        except ImportError:
+            ui.error("Unable to locate markdown in path %s" % sys.path)
+    global Markdown