summaryrefslogtreecommitdiff
path: root/nova/api/openstack/wsgi.py
diff options
context:
space:
mode:
authordineshbhor <dinesh.bhor@nttdata.com>2016-06-21 20:11:13 +0530
committerChangBo Guo(gcb) <eric.guo@easystack.cn>2016-11-17 14:50:35 +0800
commit0f152eb66153e16d4d8aba0f8afebaab046aea35 (patch)
treebecc23204c1d2fc5f9c3f1a1f77a6c71d6f57960 /nova/api/openstack/wsgi.py
parent6a2b1e2c999bae482db6027afa9deef3d27852d1 (diff)
downloadnova-0f152eb66153e16d4d8aba0f8afebaab046aea35.tar.gz
[PY3] byte/string conversions and enable PY3 test
* The dict.items()[0] will raise a TypeError in PY3, as dict.items() doesn't return a list any more in PY3 but a view of list. * Webob response body should be bytes not strings so used oslo_utils.encodeutils.safe_decode to decode it. Partially implements blueprint: goal-python35 Co-Authored-By: ChangBo Guo(gcb) <eric.guo@easystack.cn> Change-Id: I38d416923bc0cec0ca98c4494dd1e06cd49671cf
Diffstat (limited to 'nova/api/openstack/wsgi.py')
-rw-r--r--nova/api/openstack/wsgi.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 8c476824eb..4925501fa3 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -19,6 +19,7 @@ import functools
import microversion_parse
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
@@ -692,7 +693,8 @@ class Resource(wsgi.Application):
if hasattr(response, 'headers'):
for hdr, val in list(response.headers.items()):
# Headers must be utf-8 strings
- response.headers[hdr] = utils.utf8(val)
+ response.headers[hdr] = encodeutils.safe_decode(
+ utils.utf8(val))
if not request.api_version_request.is_null():
response.headers[API_VERSION_REQUEST_HEADER] = \