diff --git a/service-mgmt-api/sm-api/sm_api/common/safe_utils.py b/service-mgmt-api/sm-api/sm_api/common/safe_utils.py index 9c534d0b..ee41c64f 100644 --- a/service-mgmt-api/sm-api/sm_api/common/safe_utils.py +++ b/service-mgmt-api/sm-api/sm_api/common/safe_utils.py @@ -43,12 +43,12 @@ def getcallargs(function, *args, **kwargs): # The function may not actually be a method or have im_self. # Typically seen when it's stubbed with mox. if inspect.ismethod(function) and hasattr(function, 'im_self'): - keyed_args[argnames[0]] = function.im_self + keyed_args[argnames[0]] = function.__self__ else: keyed_args[argnames[0]] = None remaining_argnames = [x for x in argnames if x not in keyed_args] - keyed_args.update(dict(zip(remaining_argnames, args))) + keyed_args.update(dict(list(zip(remaining_argnames, args)))) if defaults: num_defaults = len(defaults) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/session.py b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/session.py index 3250e0c4..d033de74 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/session.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/session.py @@ -489,7 +489,7 @@ def _wrap_db_error(f): except Exception as e: LOG.exception(_('DB exception wrapped.')) raise exception.DBError(e) - _wrap.func_name = f.func_name + _wrap.__name__ = f.__name__ return _wrap diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py b/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py index 334e7135..8c0554ba 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/jsonutils.py @@ -54,8 +54,7 @@ _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] - -_simple_types = (type(None), int, six.string_types, bool, float, long) +_simple_types = (type(None), six.integer_types, six.string_types, bool, float) def to_primitive(value, convert_instances=False, convert_datetime=True, diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/log.py b/service-mgmt-api/sm-api/sm_api/openstack/common/log.py index ee3a337a..4b2417aa 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/log.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/log.py @@ -44,6 +44,7 @@ import os import sys import traceback +from six import moves from oslo_config import cfg from sm_api.openstack.common.gettextutils import _ @@ -289,7 +290,7 @@ class JSONFormatter(logging.Formatter): def formatException(self, ei, strip_newlines=True): lines = traceback.format_exception(*ei) if strip_newlines: - lines = [itertools.ifilter( + lines = [moves.filter( lambda x: x, line.rstrip().splitlines()) for line in lines] lines = list(itertools.chain(*lines)) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py index 9e1d7c79..ca85175e 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_zmq.py @@ -36,6 +36,7 @@ from sm_api.openstack.common import importutils from sm_api.openstack.common import jsonutils from sm_api.openstack.common import processutils as utils from sm_api.openstack.common.rpc import common as rpc_common +from functools import reduce zmq = importutils.try_import('eventlet.green.zmq')