From ae60d4ad77adb29de8bdcb3bdbd476fda35b67f4 Mon Sep 17 00:00:00 2001 From: Chang Bo Guo <guochbo@cn.ibm.com> Date: Tue, 3 Dec 2013 15:40:51 +0000 Subject: [PATCH] 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 --- oslo/messaging/_drivers/impl_zmq.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oslo/messaging/_drivers/impl_zmq.py b/oslo/messaging/_drivers/impl_zmq.py index 6dcadf67a..d149e0c31 100644 --- a/oslo/messaging/_drivers/impl_zmq.py +++ b/oslo/messaging/_drivers/impl_zmq.py @@ -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))