diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py index 8cc0049e..b9444063 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/db/sqlalchemy/models.py @@ -74,9 +74,12 @@ class ModelBase(object): return self def next(self): - n = self._i.next() + n = next(self._i) return n, getattr(self, n) + # In Python 3, __next__() has replaced next(). + __next__ = next + def update(self, values): """Make the model object behave like a dict.""" for k, v in values.items(): diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py index 7ee065ab..b0c38077 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py @@ -556,7 +556,7 @@ class MulticallWaiter(object): raise StopIteration while True: try: - self._iterator.next() + next(self._iterator) except Exception: with excutils.save_and_reraise_exception(): self.done() diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py index c5652496..e71ebb2c 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py @@ -616,7 +616,7 @@ class Connection(object): def _declare_consumer(): consumer = consumer_cls(self.conf, self.channel, topic, callback, - self.consumer_num.next()) + next(self.consumer_num)) self.consumers.append(consumer) return consumer @@ -722,7 +722,7 @@ class Connection(object): it = self.iterconsume(limit=limit) while True: try: - it.next() + next(it) except StopIteration: return diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py index 4133b7dc..304ce740 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py @@ -520,7 +520,7 @@ class Connection(object): it = self.iterconsume(limit=limit) while True: try: - it.next() + next(it) except StopIteration: return 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 cf3f40ae..3bde39f4 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 @@ -558,8 +558,8 @@ def unflatten_envelope(packenv): h = {} try: while True: - k = i.next() - h[k] = i.next() + k = next(i) + h[k] = next(i) except StopIteration: return h diff --git a/service-mgmt-client/sm-client/sm_client/common/http.py b/service-mgmt-client/sm-client/sm_client/common/http.py index 986994b0..29736835 100644 --- a/service-mgmt-client/sm-client/sm_client/common/http.py +++ b/service-mgmt-client/sm-client/sm_client/common/http.py @@ -292,7 +292,7 @@ class ResponseBodyIterator(object): def __iter__(self): while True: - yield self.next() + yield next(self) def next(self): chunk = self.resp.read(CHUNKSIZE) @@ -300,3 +300,6 @@ class ResponseBodyIterator(object): return chunk else: raise StopIteration() + + # In Python 3, __next__() has replaced next(). + __next__ = next