From aa32d721e797d4dd408d52a7e19a973bb4c5571f Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 13 Nov 2008 23:12:26 -0500 Subject: Fixed a bug in loadextension where a nonexistant extention would crash rather than generate the appropriate error message and continue. --- markdown.py | 19 ++++++++----------- 1 file 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.) 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 = [] -- cgit v1.2.3