diff options
author | Waylan Limberg <waylan@gmail.com> | 2009-08-26 18:38:24 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2009-08-26 18:38:24 -0400 |
commit | 5670f4c4f8656c91466259ca97ee66b669a1e2be (patch) | |
tree | 1c3bfcafbf62496bb5c30335b25a5926e44ef309 | |
parent | b688bf59dee2ed1552c0b232a43066ba18393ab0 (diff) | |
download | markdown-5670f4c4f8656c91466259ca97ee66b669a1e2be.tar.gz markdown-5670f4c4f8656c91466259ca97ee66b669a1e2be.tar.bz2 markdown-5670f4c4f8656c91466259ca97ee66b669a1e2be.zip |
Fixed Ticket 42. We really should abandon the 'message' function altogeather, but this will do for now.
-rw-r--r-- | markdown/__init__.py | 17 |
1 files 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 = []): |