Skip to content

Commit

Permalink
fix importlib warning and exception usage for Python 2.7+ & 3.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
RaD committed Feb 17, 2017
1 parent 1d216a2 commit 8611f6e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions flatpages_x/utils.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured

try:
from django.utils.importlib import import_module
except ImportError:
from importlib import import_module


def load_path_attr(path):
i = path.rfind(".")
module, attr = path[:i], path[i + 1:]
try:
mod = import_module(module)
except (ImportError, e):
except ImportError as e:
raise ImproperlyConfigured("Error importing %s: '%s'" % (module, e))
try:
attr = getattr(mod, attr)
Expand Down

0 comments on commit 8611f6e

Please sign in to comment.