From c61daab0ce10d9654ecb9ce70819233171885eae Mon Sep 17 00:00:00 2001 From: David Cramer Date: Fri, 27 May 2011 15:13:41 -0700 Subject: Change __import__ usage to to be import_module, adjust test reqs to specify >= 1.1,< 1.4, and add note about required Django version --- README.rst | 2 ++ debug_toolbar/middleware.py | 3 ++- setup.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index e7888c5..0ec29e4 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,8 @@ There is also one Django management command currently: If you have ideas for other panels please let us know. +* Note: The Debug Toolbar only works on Django 1.1 and newer. + Installation ============ diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index fa64a16..05d8e80 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -9,6 +9,7 @@ from django.conf.urls.defaults import include, patterns from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.utils.encoding import smart_unicode +from django.utils.importlib import import_module import debug_toolbar.urls from debug_toolbar.toolbar.loader import DebugToolbar @@ -79,7 +80,7 @@ class DebugToolbarMiddleware(object): urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF) if isinstance(urlconf, basestring): - urlconf = __import__(getattr(request, 'urlconf', settings.ROOT_URLCONF), {}, {}, ['*']) + urlconf = import_module(getattr(request, 'urlconf', settings.ROOT_URLCONF)) if urlconf not in self._urlconfs: new_urlconf = imp.new_module('urlconf') diff --git a/setup.py b/setup.py index 773c5c6..4314988 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( license='BSD', packages=find_packages(exclude=['ez_setup']), tests_require=[ - 'django', + 'django>=1.1,<1.4', 'dingus', ], test_suite='debug_toolbar.runtests.runtests', -- cgit v1.2.3