From c485e236bd7e5ea40c64b2fe54d85dbb15b2fd39 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Wed, 18 Mar 2009 16:55:59 +0000 Subject: 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 --- django/template/context.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'django/template/context.py') diff --git a/django/template/context.py b/django/template/context.py index 8f16a95021..1f136595e1 100644 --- a/django/template/context.py +++ b/django/template/context.py @@ -1,5 +1,6 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured +from django.utils.importlib import import_module _standard_context_processors = None @@ -62,7 +63,7 @@ class Context(object): def update(self, other_dict): "Like dict.update(). Pushes an entire dictionary's keys and values onto the context." - if not hasattr(other_dict, '__getitem__'): + if not hasattr(other_dict, '__getitem__'): raise TypeError('other_dict must be a mapping (dictionary-like) object.') self.dicts = [other_dict] + self.dicts return other_dict @@ -77,7 +78,7 @@ def get_standard_processors(): i = path.rfind('.') module, attr = path[:i], path[i+1:] try: - mod = __import__(module, {}, {}, [attr]) + mod = import_module(module) except ImportError, e: raise ImproperlyConfigured('Error importing request processor module %s: "%s"' % (module, e)) try: -- cgit v1.3