Unify different names between Python2/3 with six.moves

Some modules use different names in Python2 and Python3. Use six.moves
to make them work well in Python2 and Python3.
This is changes mapping:

six.moves      Python 2       Python 3
reduce         reduce()      functools.reduce()

Implements: blueprint make-python3-compatible
Change-Id: I97971f2ab40385bfc2c73ae7e8a7620c4d64a03c
This commit is contained in:
Chang Bo Guo 2013-12-03 15:40:51 +00:00 committed by Mark McLoughlin
parent fda06f6806
commit ae60d4ad77
1 changed files with 2 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import uuid
import eventlet
import greenlet
from oslo.config import cfg
from six import moves
from oslo.messaging._drivers import base
from oslo.messaging._drivers import common as rpc_common
@ -232,7 +233,7 @@ class ZmqClient(object):
return
rpc_envelope = rpc_common.serialize_msg(data[1], envelope)
zmq_msg = reduce(lambda x, y: x + y, rpc_envelope.items())
zmq_msg = moves.reduce(lambda x, y: x + y, rpc_envelope.items())
self.outq.send(map(bytes,
(msg_id, topic, 'impl_zmq_v2', data[0]) + zmq_msg))