aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2014-05-23 20:20:08 -0400
committerWaylan Limberg <waylan@gmail.com>2014-05-23 20:20:08 -0400
commitd10f73cc0184ef93e042c381eadc6f09642b52ee (patch)
tree7dab9a711c714d08095c96eb12e40defa3604ebf
parente4c13788f1c6f6f204ca7c471b25246f6c156832 (diff)
downloadmarkdown-d10f73cc0184ef93e042c381eadc6f09642b52ee.tar.gz
markdown-d10f73cc0184ef93e042c381eadc6f09642b52ee.tar.bz2
markdown-d10f73cc0184ef93e042c381eadc6f09642b52ee.zip
Support extensions as modules.
Fixes #300. When a python module (.../__init__.py) is imported by `__import__` and the `from_list` argument is a unicode string (as is returned by rpartition), then an error is raised in Python 2.7. Force conversion to default string type (byte in 2.7 and unicode in 3) to avoid the error. For a full explaination, see issue [300](https://github.com/waylan/Python-Markdown/issues/300).
-rw-r--r--markdown/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 4943388..378f873 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -194,7 +194,7 @@ class Markdown(object):
# Try loading the extension first from one place, then another
try: # New style (markdown.extensions.<extension>)
- module = __import__(module_name, {}, {}, [module_name.rpartition('.')[0]])
+ module = __import__(module_name, {}, {}, [str(module_name.rpartition('.')[0])])
except ImportError:
module_name_old_style = '_'.join(['mdx', ext_name])
try: # Old style (mdx_<extension>)