From 5cba8de9a06e2adf25f4b11c62a813b389eb1fc2 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 29 Apr 2014 17:21:52 +0200 Subject: [PATCH] Synced jsonutils from oslo-incubator The sync includes change that drastically enhances performance on Python 2.6 with fresh simplejson library installed. The latest commit in oslo-incubator: - 732bdb6297eb9de81667f7713ebcb1ccc2ee45a7 Change-Id: Ib3dc0b713ed90396919feba018772243b3b9c90f Closes-Bug: 1314129 --- tuskar/openstack/common/jsonutils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tuskar/openstack/common/jsonutils.py b/tuskar/openstack/common/jsonutils.py index a6142ec4..5a3b9e1a 100644 --- a/tuskar/openstack/common/jsonutils.py +++ b/tuskar/openstack/common/jsonutils.py @@ -35,7 +35,17 @@ import datetime import functools import inspect import itertools -import json +import sys + +if sys.version_info < (2, 7): + # On Python <= 2.6, json module is not C boosted, so try to use + # simplejson module if available + try: + import simplejson as json + except ImportError: + import json +else: + import json import six import six.moves.xmlrpc_client as xmlrpclib