summaryrefslogtreecommitdiff
path: root/django/core/files
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/files')
-rw-r--r--django/core/files/storage.py3
-rw-r--r--django/core/files/uploadhandler.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/django/core/files/storage.py b/django/core/files/storage.py
index a1b843d5a1..bf30a787bb 100644
--- a/django/core/files/storage.py
+++ b/django/core/files/storage.py
@@ -8,6 +8,7 @@ from django.core.files import locks, File
from django.core.files.move import file_move_safe
from django.utils.encoding import force_unicode
from django.utils.functional import LazyObject
+from django.utils.importlib import import_module
from django.utils.text import get_valid_filename
from django.utils._os import safe_join
@@ -230,7 +231,7 @@ def get_storage_class(import_path=None):
raise ImproperlyConfigured("%s isn't a storage module." % import_path)
module, classname = import_path[:dot], import_path[dot+1:]
try:
- mod = __import__(module, {}, {}, [''])
+ mod = import_module(module)
except ImportError, e:
raise ImproperlyConfigured('Error importing storage module %s: "%s"' % (module, e))
try:
diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py
index b93ff9446e..6a0eebe43e 100644
--- a/django/core/files/uploadhandler.py
+++ b/django/core/files/uploadhandler.py
@@ -10,6 +10,7 @@ except ImportError:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import TemporaryUploadedFile, InMemoryUploadedFile
+from django.utils import importlib
__all__ = ['UploadFileException','StopUpload', 'SkipFile', 'FileUploadHandler',
'TemporaryFileUploadHandler', 'MemoryFileUploadHandler',
@@ -201,7 +202,7 @@ def load_handler(path, *args, **kwargs):
i = path.rfind('.')
module, attr = path[:i], path[i+1:]
try:
- mod = __import__(module, {}, {}, [attr])
+ mod = importlib.import_module(module)
except ImportError, e:
raise ImproperlyConfigured('Error importing upload handler module %s: "%s"' % (module, e))
except ValueError, e: