diff options
author | Takashi Natsume <takanattie@gmail.com> | 2020-05-14 14:35:21 +0000 |
---|---|---|
committer | Takashi Natsume <takanattie@gmail.com> | 2020-12-13 11:25:31 +0000 |
commit | 383e2a8bdcc9210cbe9719d3470fe15b787d46b0 (patch) | |
tree | c557f23bf49e83b877afb39010cf4594f0909a4e /nova/api/openstack/wsgi.py | |
parent | 07462dd0050fbfea89e517759b312b67a368e279 (diff) | |
download | nova-383e2a8bdcc9210cbe9719d3470fe15b787d46b0.tar.gz |
Remove six.text_type (1/2)
Replace six.text_type with str.
A subsequent patch will replace other six.text_type.
Change-Id: I23bb9e539d08f5c6202909054c2dd49b6c7a7a0e
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
Diffstat (limited to 'nova/api/openstack/wsgi.py')
-rw-r--r-- | nova/api/openstack/wsgi.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index ff340d9067..706ac603d6 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -21,7 +21,6 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import encodeutils from oslo_utils import strutils -import six import webob from nova.api.openstack import api_version_request as api_version @@ -220,7 +219,7 @@ class JSONDictSerializer(ActionDispatcher): return self.dispatch(data, action=action) def default(self, data): - return six.text_type(jsonutils.dumps(data)) + return str(jsonutils.dumps(data)) def response(code): @@ -293,8 +292,8 @@ class ResponseObject(object): response.headers[hdr] = encodeutils.safe_decode( encodeutils.safe_encode(val)) # Deal with content_type - if not isinstance(content_type, six.text_type): - content_type = six.text_type(content_type) + if not isinstance(content_type, str): + content_type = str(content_type) # In Py3.X Headers must be a str. response.headers['Content-Type'] = encodeutils.safe_decode( encodeutils.safe_encode(content_type)) @@ -506,7 +505,7 @@ class Resource(wsgi.Application): if body: msg = _("Action: '%(action)s', calling method: %(meth)s, body: " "%(body)s") % {'action': action, - 'body': six.text_type(body, 'utf-8'), + 'body': str(body, 'utf-8'), 'meth': str(meth)} LOG.debug(strutils.mask_password(msg)) else: @@ -562,8 +561,8 @@ class Resource(wsgi.Application): if hasattr(response, 'headers'): for hdr, val in list(response.headers.items()): - if not isinstance(val, six.text_type): - val = six.text_type(val) + if not isinstance(val, str): + val = str(val) # In Py3.X Headers must be a string response.headers[hdr] = encodeutils.safe_decode( encodeutils.safe_encode(val)) |