diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-18 16:55:59 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-18 16:55:59 +0000 |
| commit | c485e236bd7e5ea40c64b2fe54d85dbb15b2fd39 (patch) | |
| tree | fc5e86abf39b69181b2084f5c39038f1811b6b44 /django/core/cache/__init__.py | |
| parent | ee2f04d79e5bca55637b9bb3301618738a4e342a (diff) | |
Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/cache/__init__.py')
| -rw-r--r-- | django/core/cache/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index 23a61ef859..739d3c4834 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -19,6 +19,7 @@ from cgi import parse_qsl from django.conf import settings from django.core import signals from django.core.cache.backends.base import InvalidCacheBackendError +from django.utils import importlib # Name for use in settings file --> name of module in "backends" directory. # Any backend scheme that is not in this dictionary is treated as a Python @@ -58,9 +59,10 @@ def parse_backend_uri(backend_uri): def get_cache(backend_uri): scheme, host, params = parse_backend_uri(backend_uri) if scheme in BACKENDS: - module = __import__('django.core.cache.backends.%s' % BACKENDS[scheme], {}, {}, ['']) + name = 'django.core.cache.backends.%s' % BACKENDS[scheme] else: - module = __import__(scheme, {}, {}, ['']) + name = scheme + module = importlib.import_module(name) return getattr(module, 'CacheClass')(host, params) cache = get_cache(settings.CACHE_BACKEND) |
