Merge "Use OSLO jsonutils instead of json module"
This commit is contained in:
@@ -34,11 +34,6 @@ except ImportError:
|
|||||||
keyring = None
|
keyring = None
|
||||||
pickle = None
|
pickle = None
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
# Python 2.5 compat fix
|
# Python 2.5 compat fix
|
||||||
if not hasattr(urlparse, 'parse_qsl'):
|
if not hasattr(urlparse, 'parse_qsl'):
|
||||||
import cgi
|
import cgi
|
||||||
@@ -47,6 +42,7 @@ if not hasattr(urlparse, 'parse_qsl'):
|
|||||||
|
|
||||||
from keystoneclient import access
|
from keystoneclient import access
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
|
from keystoneclient.openstack.common import jsonutils
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@@ -587,7 +583,7 @@ class HTTPClient(object):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def serialize(self, entity):
|
def serialize(self, entity):
|
||||||
return json.dumps(entity)
|
return jsonutils.dumps(entity)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def service_catalog(self):
|
def service_catalog(self):
|
||||||
@@ -623,7 +619,7 @@ class HTTPClient(object):
|
|||||||
|
|
||||||
if resp.text:
|
if resp.text:
|
||||||
try:
|
try:
|
||||||
body_resp = json.loads(resp.text)
|
body_resp = jsonutils.loads(resp.text)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
body_resp = None
|
body_resp = None
|
||||||
_logger.debug("Could not decode JSON from body: %s"
|
_logger.debug("Could not decode JSON from body: %s"
|
||||||
|
@@ -146,7 +146,6 @@ keystone.token_info
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import httplib
|
import httplib
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import stat
|
import stat
|
||||||
@@ -783,7 +782,7 @@ class AuthProtocol(object):
|
|||||||
return cached
|
return cached
|
||||||
if cms.is_ans1_token(user_token):
|
if cms.is_ans1_token(user_token):
|
||||||
verified = self.verify_signed_token(user_token)
|
verified = self.verify_signed_token(user_token)
|
||||||
data = json.loads(verified)
|
data = jsonutils.loads(verified)
|
||||||
else:
|
else:
|
||||||
data = self.verify_uuid_token(user_token, retry)
|
data = self.verify_uuid_token(user_token, retry)
|
||||||
expires = self._confirm_token_not_expired(data)
|
expires = self._confirm_token_not_expired(data)
|
||||||
@@ -973,8 +972,8 @@ class AuthProtocol(object):
|
|||||||
|
|
||||||
# Note that 'invalid' and (data, expires) are the only
|
# Note that 'invalid' and (data, expires) are the only
|
||||||
# valid types of serialized cache entries, so there is not
|
# valid types of serialized cache entries, so there is not
|
||||||
# a collision with json.loads(serialized) == None.
|
# a collision with jsonutils.loads(serialized) == None.
|
||||||
cached = json.loads(serialized)
|
cached = jsonutils.loads(serialized)
|
||||||
if cached == 'invalid':
|
if cached == 'invalid':
|
||||||
self.LOG.debug('Cached Token %s is marked unauthorized',
|
self.LOG.debug('Cached Token %s is marked unauthorized',
|
||||||
token_id)
|
token_id)
|
||||||
@@ -993,7 +992,7 @@ class AuthProtocol(object):
|
|||||||
data may be the string 'invalid' or a tuple like (data, expires)
|
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:
|
if self._memcache_security_strategy is None:
|
||||||
cache_key = CACHE_KEY_TEMPLATE % token_id
|
cache_key = CACHE_KEY_TEMPLATE % token_id
|
||||||
data_to_store = serialized_data
|
data_to_store = serialized_data
|
||||||
|
@@ -12,11 +12,11 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
from keystoneclient import httpclient
|
from keystoneclient import httpclient
|
||||||
|
from keystoneclient.openstack.common import jsonutils
|
||||||
from keystoneclient.v3.contrib import trusts
|
from keystoneclient.v3.contrib import trusts
|
||||||
from keystoneclient.v3 import credentials
|
from keystoneclient.v3 import credentials
|
||||||
from keystoneclient.v3 import domains
|
from keystoneclient.v3 import domains
|
||||||
@@ -104,7 +104,7 @@ class Client(httpclient.HTTPClient):
|
|||||||
self.authenticate()
|
self.authenticate()
|
||||||
|
|
||||||
def serialize(self, entity):
|
def serialize(self, entity):
|
||||||
return json.dumps(entity, sort_keys=True)
|
return jsonutils.dumps(entity, sort_keys=True)
|
||||||
|
|
||||||
def process_token(self):
|
def process_token(self):
|
||||||
"""Extract and process information from the new auth_ref.
|
"""Extract and process information from the new auth_ref.
|
||||||
|
Reference in New Issue
Block a user