From 5670f4c4f8656c91466259ca97ee66b669a1e2be Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 26 Aug 2009 18:38:24 -0400 Subject: Fixed Ticket 42. We really should abandon the 'message' function altogeather, but this will do for now. --- markdown/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/markdown/__init__.py b/markdown/__init__.py index 6010715..235c90f 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -327,12 +327,14 @@ class Markdown: for ext in extensions: if isinstance(ext, basestring): ext = load_extension(ext, configs.get(ext, [])) - try: - ext.extendMarkdown(self, globals()) - except AttributeError: - message(ERROR, "Incorrect type! Extension '%s' is " - "neither a string or an Extension." %(repr(ext))) - + if isinstance(ext, Extension): + try: + ext.extendMarkdown(self, globals()) + except NotImplementedError, e: + message(ERROR, e) + else: + message(ERROR, 'Extension "%s.%s" must be of type: "markdown.Extension".' \ + % (ext.__class__.__module__, ext.__class__.__name__)) def registerExtension(self, extension): """ This gets called by the extension """ @@ -499,7 +501,8 @@ class Extension: * md_globals: Global variables in the markdown module namespace. """ - pass + raise NotImplementedError, 'Extension "%s.%s" must define an "extendMarkdown"' \ + 'method.' % (self.__class__.__module__, self.__class__.__name__) def load_extension(ext_name, configs = []): -- cgit v1.2.3