diff options
| author | Simon Charette | 2012-12-30 17:52:56 -0500 |
|---|---|---|
| committer | Simon Charette | 2012-12-30 17:52:56 -0500 |
| commit | d4971605cc0f82315805c44ea8346f609b1f07bb (patch) | |
| tree | e73e04f256b634868bfeaefe036bd96e1c0e749c /debug_toolbar/utils/tracking/db.py | |
| parent | 22ebebd29b5d42ae50e9681847784713fa67daf5 (diff) | |
| download | django-debug-toolbar-d4971605cc0f82315805c44ea8346f609b1f07bb.tar.bz2 | |
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.
Diffstat (limited to 'debug_toolbar/utils/tracking/db.py')
| -rw-r--r-- | debug_toolbar/utils/tracking/db.py | 10 |
1 files changed, 7 insertions, 3 deletions
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,7 +5,6 @@ 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, \ @@ -13,8 +12,13 @@ from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, \ 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: |
