Fix urllib import issue for Python2/3 compatible code.
change urlparse to 'from six.moves.urllib.parse import urlparse' and remove obsolete code Story:2003430 Task:27479 Change-Id: I38e75f5faa55046517f1e479b18ebcef0304e471 Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
1477d25d55
commit
de91fb2ac1
@ -24,8 +24,9 @@ SQLAlchemy models for sm_api data.
|
||||
"""
|
||||
|
||||
import json
|
||||
import urlparse
|
||||
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from oslo_config import cfg
|
||||
|
||||
from sqlalchemy import Column, ForeignKey, Integer, Boolean
|
||||
@ -46,7 +47,7 @@ cfg.CONF.register_opts(sql_opts, 'database')
|
||||
|
||||
|
||||
def table_args():
|
||||
engine_name = urlparse.urlparse(cfg.CONF.database_connection).scheme
|
||||
engine_name = urlparse(cfg.CONF.database_connection).scheme
|
||||
if engine_name == 'mysql':
|
||||
return {'mysql_engine': cfg.CONF.mysql_engine,
|
||||
'mysql_charset': "utf8"}
|
||||
|
@ -23,7 +23,7 @@ import logging
|
||||
import os
|
||||
import socket
|
||||
import StringIO
|
||||
import urlparse
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
try:
|
||||
import ssl
|
||||
@ -36,12 +36,6 @@ try:
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
# Python 2.5 compat fix
|
||||
if not hasattr(urlparse, 'parse_qsl'):
|
||||
import cgi
|
||||
urlparse.parse_qsl = cgi.parse_qsl
|
||||
|
||||
|
||||
from sm_client import exc
|
||||
|
||||
|
||||
@ -59,7 +53,7 @@ class HTTPClient(object):
|
||||
|
||||
@staticmethod
|
||||
def get_connection_params(endpoint, **kwargs):
|
||||
parts = urlparse.urlparse(endpoint)
|
||||
parts = urlparse(endpoint)
|
||||
|
||||
_args = (parts.hostname, parts.port, parts.path)
|
||||
_kwargs = {'timeout': (float(kwargs.get('timeout'))
|
||||
|
Loading…
Reference in New Issue
Block a user