diff options
author | Waylan Limberg <waylan@gmail.com> | 2014-05-23 20:20:08 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2014-05-23 20:20:08 -0400 |
commit | d10f73cc0184ef93e042c381eadc6f09642b52ee (patch) | |
tree | 7dab9a711c714d08095c96eb12e40defa3604ebf | |
parent | e4c13788f1c6f6f204ca7c471b25246f6c156832 (diff) | |
download | markdown-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__.py | 2 |
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>) |