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/loader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django/template/loader.py') diff --git a/django/template/loader.py b/django/template/loader.py index 1d7d945ef7..8195c4b798 100644 --- a/django/template/loader.py +++ b/django/template/loader.py @@ -22,6 +22,7 @@ from django.core.exceptions import ImproperlyConfigured from django.template import Origin, Template, Context, TemplateDoesNotExist, add_to_builtins +from django.utils.importlib import import_module from django.conf import settings template_source_loaders = None @@ -51,7 +52,7 @@ def find_template_source(name, dirs=None): i = path.rfind('.') module, attr = path[:i], path[i+1:] try: - mod = __import__(module, globals(), locals(), [attr]) + mod = import_module(module) except ImportError, e: raise ImproperlyConfigured, 'Error importing template source loader %s: "%s"' % (module, e) try: -- cgit v1.3