From 675f33d664184093187a04b27e6fab2ff61c8074 Mon Sep 17 00:00:00 2001 From: IWAMOTO Toshihiro Date: Tue, 30 Jun 2015 17:01:54 +0900 Subject: python3: Use six.binary_type for I/O of ryu.lib.rpc While msgpack has default binary-unicode conversion, the feature is somehow disabled in ryu. As the other parts of ryu requires binary_type data where they directly appear on-wire, simply follow the policy. Signed-off-by: IWAMOTO Toshihiro Signed-off-by: FUJITA Tomonori --- ryu/lib/rpc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ryu/lib/rpc.py') diff --git a/ryu/lib/rpc.py b/ryu/lib/rpc.py index adbcb9ae..57ba00c9 100644 --- a/ryu/lib/rpc.py +++ b/ryu/lib/rpc.py @@ -20,6 +20,7 @@ # http://wiki.msgpack.org/display/MSGPACK/RPC+specification import msgpack +import six class MessageType(object): @@ -49,7 +50,7 @@ class MessageEncoder(object): return this_id def create_request(self, method, params): - assert isinstance(method, str) + assert isinstance(method, six.binary_type) assert isinstance(params, list) msgid = self._create_msgid() return (self._packer.pack([MessageType.REQUEST, msgid, method, @@ -62,7 +63,7 @@ class MessageEncoder(object): return self._packer.pack([MessageType.RESPONSE, msgid, error, result]) def create_notification(self, method, params): - assert isinstance(method, str) + assert isinstance(method, six.binary_type) assert isinstance(params, list) return self._packer.pack([MessageType.NOTIFY, method, params]) -- cgit v1.2.3