aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-13 23:12:26 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-13 23:28:02 -0500
commitaa32d721e797d4dd408d52a7e19a973bb4c5571f (patch)
tree02e77e3e4013063a4b9037ed31919a1257ad0695
parent59d860ec5dc701a0e2335c24f43e8960fee040dd (diff)
downloadmarkdown-aa32d721e797d4dd408d52a7e19a973bb4c5571f.tar.gz
markdown-aa32d721e797d4dd408d52a7e19a973bb4c5571f.tar.bz2
markdown-aa32d721e797d4dd408d52a7e19a973bb4c5571f.zip
Fixed a bug in loadextension where a nonexistant extention would crash rather than generate the appropriate error message and continue.
-rwxr-xr-xmarkdown.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/markdown.py b/markdown.py
index f4536a2..baf6567 100755
--- a/markdown.py
+++ b/markdown.py
@@ -2096,19 +2096,16 @@ def load_extension(ext_name, configs = []):
try: # Old style (mdx.<extension>)
module = __import__(module_name_old_style)
except ImportError:
- pass
-
- if module :
- # If the module is loaded successfully, we expect it to define a
- # function called makeExtension()
- try:
- return module.makeExtension(configs.items())
- except:
- message(CRITICAL, "Failed to instantiate extension '%s'" % ext_name)
- else:
- message(CRITICAL, "Failed loading extension '%s' from '%s' or '%s'"
+ message(CRITICAL, "Failed loading extension '%s' from '%s' or '%s'"
% (ext_name, module_name_new_style, module_name_old_style))
+ # If the module is loaded successfully, we expect it to define a
+ # function called makeExtension()
+ try:
+ return module.makeExtension(configs.items())
+ except:
+ message(CRITICAL, "Failed to instantiate extension '%s'" % ext_name)
+
def load_extensions(ext_names):
"""Loads multiple extensions"""
extensions = []