Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Merge pull request #164 from generalov/master
Browse files Browse the repository at this point in the history
Use importlib to import markdown extensions
  • Loading branch information
Julien Bouquillon committed Jan 22, 2014
2 parents fc587c1 + 9222b4e commit 158eb0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion markdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
import re
import codecs
import sys
import sublime
import logging
import importlib
from . import util
from .preprocessors import build_preprocessors
from .blockprocessors import build_block_parser
Expand Down Expand Up @@ -200,7 +202,7 @@ def build_extension(self, ext_name, configs = []):

# Try loading the extension first from one place, then another
try: # New style (markdown.extensons.<extension>)
module = __import__(module_name, {}, {}, [module_name.rpartition('.')[0]])
module = importlib.import_module(module_name)
except ImportError:
module_name_old_style = '_'.join(['mdx', ext_name])
try: # Old style (mdx_<extension>)
Expand Down

0 comments on commit 158eb0a

Please sign in to comment.