diff --git a/oslo/messaging/openstack/common/__init__.py b/oslo/messaging/openstack/common/__init__.py index e69de29bb..d1223eaf7 100644 --- a/oslo/messaging/openstack/common/__init__.py +++ b/oslo/messaging/openstack/common/__init__.py @@ -0,0 +1,17 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import six + + +six.add_move(six.MovedModule('mox', 'mox', 'mox3.mox')) diff --git a/oslo/messaging/openstack/common/jsonutils.py b/oslo/messaging/openstack/common/jsonutils.py index 24f3784d8..72cc2ee28 100644 --- a/oslo/messaging/openstack/common/jsonutils.py +++ b/oslo/messaging/openstack/common/jsonutils.py @@ -35,18 +35,20 @@ import datetime import functools import inspect import itertools -import json -try: - import xmlrpclib -except ImportError: - # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3 - # however the function and object call signatures - # remained the same. This whole try/except block should - # be removed and replaced with a call to six.moves once - # six 1.4.2 is released. See http://bit.ly/1bqrVzu - import xmlrpc.client as xmlrpclib +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 from oslo.messaging.openstack.common import gettextutils from oslo.messaging.openstack.common import importutils