Fix versions Controller for Py3
the webob's Response.body in fact accepts only bytes, so under Python3 an attempt to assign a text value to webob's response.body produces the following exception: TypeError: You cannot set Response.body to a text object (use Response.text) Change-Id: I6352ec0662441dab039f15b35c8383e6d7d3dc78 Story: 2002531 Task: 22076
This commit is contained in:
parent
63cf3761be
commit
80f68801d1
@ -14,6 +14,7 @@
|
||||
"""Controller that returns information on the heat API versions."""
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
import webob.dec
|
||||
|
||||
@ -44,7 +45,9 @@ class Controller(object):
|
||||
response = webob.Response(request=req,
|
||||
status=http_client.MULTIPLE_CHOICES,
|
||||
content_type='application/json')
|
||||
response.body = body
|
||||
# NOTE(pas-ha) in WebOb, Response.body accepts only bytes,
|
||||
# and Response.text accepts only unicode.
|
||||
response.text = six.text_type(body)
|
||||
|
||||
return response
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user