Merge "Use OSLO jsonutils instead of json module"

This commit is contained in:
Jenkins
2013-08-30 02:24:42 +00:00
committed by Gerrit Code Review
3 changed files with 9 additions and 14 deletions

View File

@@ -34,11 +34,6 @@ except ImportError:
keyring = None
pickle = None
try:
import json
except ImportError:
import simplejson as json
# Python 2.5 compat fix
if not hasattr(urlparse, 'parse_qsl'):
import cgi
@@ -47,6 +42,7 @@ if not hasattr(urlparse, 'parse_qsl'):
from keystoneclient import access
from keystoneclient import exceptions
from keystoneclient.openstack.common import jsonutils
_logger = logging.getLogger(__name__)
@@ -587,7 +583,7 @@ class HTTPClient(object):
raise NotImplementedError
def serialize(self, entity):
return json.dumps(entity)
return jsonutils.dumps(entity)
@property
def service_catalog(self):
@@ -623,7 +619,7 @@ class HTTPClient(object):
if resp.text:
try:
body_resp = json.loads(resp.text)
body_resp = jsonutils.loads(resp.text)
except (ValueError, TypeError):
body_resp = None
_logger.debug("Could not decode JSON from body: %s"

View File

@@ -146,7 +146,6 @@ keystone.token_info
import datetime
import httplib
import json
import logging
import os
import stat
@@ -783,7 +782,7 @@ class AuthProtocol(object):
return cached
if cms.is_ans1_token(user_token):
verified = self.verify_signed_token(user_token)
data = json.loads(verified)
data = jsonutils.loads(verified)
else:
data = self.verify_uuid_token(user_token, retry)
expires = self._confirm_token_not_expired(data)
@@ -973,8 +972,8 @@ class AuthProtocol(object):
# Note that 'invalid' and (data, expires) are the only
# valid types of serialized cache entries, so there is not
# a collision with json.loads(serialized) == None.
cached = json.loads(serialized)
# a collision with jsonutils.loads(serialized) == None.
cached = jsonutils.loads(serialized)
if cached == 'invalid':
self.LOG.debug('Cached Token %s is marked unauthorized',
token_id)
@@ -993,7 +992,7 @@ class AuthProtocol(object):
data may be the string 'invalid' or a tuple like (data, expires)
"""
serialized_data = json.dumps(data)
serialized_data = jsonutils.dumps(data)
if self._memcache_security_strategy is None:
cache_key = CACHE_KEY_TEMPLATE % token_id
data_to_store = serialized_data

View File

@@ -12,11 +12,11 @@
# 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 json
import logging
from keystoneclient import exceptions
from keystoneclient import httpclient
from keystoneclient.openstack.common import jsonutils
from keystoneclient.v3.contrib import trusts
from keystoneclient.v3 import credentials
from keystoneclient.v3 import domains
@@ -104,7 +104,7 @@ class Client(httpclient.HTTPClient):
self.authenticate()
def serialize(self, entity):
return json.dumps(entity, sort_keys=True)
return jsonutils.dumps(entity, sort_keys=True)
def process_token(self):
"""Extract and process information from the new auth_ref.