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/views | |
| 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/views')
| -rw-r--r-- | django/views/debug.py | 4 | ||||
| -rw-r--r-- | django/views/i18n.py | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index d1e9259243..f2288cf173 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -6,6 +6,7 @@ import datetime from django.conf import settings from django.template import Template, Context, TemplateDoesNotExist from django.utils.html import escape +from django.utils.importlib import import_module from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound from django.utils.encoding import smart_unicode, smart_str @@ -67,7 +68,8 @@ class ExceptionReporter: self.loader_debug_info = [] for loader in template_source_loaders: try: - source_list_func = getattr(__import__(loader.__module__, {}, {}, ['get_template_sources']), 'get_template_sources') + module = import_module(loader.__module__) + source_list_func = module.get_template_sources # NOTE: This assumes exc_value is the name of the template that # the loader attempted to load. template_list = [{'name': t, 'exists': os.path.exists(t)} \ diff --git a/django/views/i18n.py b/django/views/i18n.py index e141c1d967..0280698aae 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -1,7 +1,8 @@ from django import http +from django.conf import settings +from django.utils import importlib from django.utils.translation import check_for_language, activate, to_locale, get_language from django.utils.text import javascript_quote -from django.conf import settings import os import gettext as gettext_module @@ -128,7 +129,7 @@ def javascript_catalog(request, domain='djangojs', packages=None): paths = [] # first load all english languages files for defaults for package in packages: - p = __import__(package, {}, {}, ['']) + p = importlib.import_module(package) path = os.path.join(os.path.dirname(p.__file__), 'locale') paths.append(path) try: |
