Fix python 2 and 3 compatibility issue with six
httplib and ConfigParser are available in python2 but not in python3. ref:http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html Targets blueprint: murano-python-3-support Change-Id: I5164c9208f1626ea60cde47ded6cd74fbff919fd
This commit is contained in:
@@ -12,10 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import httplib
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from six.moves import http_client
|
||||
import webob.dec
|
||||
|
||||
from murano.common import wsgi
|
||||
@@ -48,7 +47,7 @@ class Controller(object):
|
||||
])
|
||||
|
||||
response = webob.Response(request=req,
|
||||
status=httplib.MULTIPLE_CHOICES,
|
||||
status=http_client.MULTIPLE_CHOICES,
|
||||
content_type='application/json')
|
||||
response.body = jsonutils.dumps(dict(versions=version_objs))
|
||||
return response
|
||||
|
@@ -18,10 +18,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ConfigParser
|
||||
import os
|
||||
import sys
|
||||
|
||||
from six.moves import configparser
|
||||
|
||||
import install_venv_common as install_venv # flake8: noqa
|
||||
|
||||
|
||||
@@ -57,7 +58,7 @@ def main(argv):
|
||||
pip_requires = os.path.join(root, 'requirements.txt')
|
||||
test_requires = os.path.join(root, 'test-requirements.txt')
|
||||
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
|
||||
setup_cfg = ConfigParser.ConfigParser()
|
||||
setup_cfg = configparser.configparser()
|
||||
setup_cfg.read('setup.cfg')
|
||||
project = setup_cfg.get('metadata', 'name')
|
||||
|
||||
|
Reference in New Issue
Block a user