From d4971605cc0f82315805c44ea8346f609b1f07bb Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 30 Dec 2012 17:52:56 -0500 Subject: Use the built-in json module on python >= 2.6. `django.utils.simplejson` is pending deprecation as of django 1.5 and will be removed in 1.7. --- debug_toolbar/utils/tracking/db.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'debug_toolbar/utils/tracking/db.py') diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py index 0dc22a6..d898b31 100644 --- a/debug_toolbar/utils/tracking/db.py +++ b/debug_toolbar/utils/tracking/db.py @@ -5,16 +5,20 @@ from threading import local from django.conf import settings from django.template import Node -from django.utils import simplejson from django.utils.encoding import force_unicode, smart_str from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, \ get_template_info, get_stack from debug_toolbar.utils.compat.db import connections +try: + import json +except ImportError: # python < 2.6 + from django.utils import simplejson as json + try: from hashlib import sha1 -except ImportError: +except ImportError: # python < 2.5 from django.utils.hashcompat import sha_constructor as sha1 # TODO:This should be set in the toolbar loader as a default and panels should @@ -103,7 +107,7 @@ class NormalCursorWrapper(object): stacktrace = [] _params = '' try: - _params = simplejson.dumps( + _params = json.dumps( [force_unicode(x, strings_only=True) for x in params] ) except TypeError: -- cgit v1.2.3