summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-03-18 16:55:59 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-03-18 16:55:59 +0000
commitc485e236bd7e5ea40c64b2fe54d85dbb15b2fd39 (patch)
treefc5e86abf39b69181b2084f5c39038f1811b6b44 /django/test
parentee2f04d79e5bca55637b9bb3301618738a4e342a (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/test')
-rw-r--r--django/test/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/test/client.py b/django/test/client.py
index 6c5f4ff4a9..b1421901e2 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -18,6 +18,7 @@ from django.test import signals
from django.utils.functional import curry
from django.utils.encoding import smart_str
from django.utils.http import urlencode
+from django.utils.importlib import import_module
from django.utils.itercompat import is_iterable
from django.db import transaction, close_connection
from django.test.utils import ContextList
@@ -176,7 +177,7 @@ class Client(object):
Obtains the current session variables.
"""
if 'django.contrib.sessions' in settings.INSTALLED_APPS:
- engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
+ engine = import_module(settings.SESSION_ENGINE)
cookie = self.cookies.get(settings.SESSION_COOKIE_NAME, None)
if cookie:
return engine.SessionStore(cookie.value)
@@ -399,7 +400,7 @@ class Client(object):
user = authenticate(**credentials)
if user and user.is_active \
and 'django.contrib.sessions' in settings.INSTALLED_APPS:
- engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
+ engine = import_module(settings.SESSION_ENGINE)
# Create a fake request to store login details.
request = HttpRequest()
@@ -434,7 +435,7 @@ class Client(object):
Causes the authenticated user to be logged out.
"""
- session = __import__(settings.SESSION_ENGINE, {}, {}, ['']).SessionStore()
+ session = import_module(settings.SESSION_ENGINE).SessionStore()
session.delete(session_key=self.cookies[settings.SESSION_COOKIE_NAME].value)
self.cookies = SimpleCookie()