diff options
author | IWAMOTO Toshihiro <iwamoto@valinux.co.jp> | 2015-06-30 17:01:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-01 10:13:22 +0900 |
commit | 675f33d664184093187a04b27e6fab2ff61c8074 (patch) | |
tree | b27279c268ba6bde8b882a0e3ffc4f745497b93e /ryu/lib/rpc.py | |
parent | 464f56070d2f7a70e9c7be18cd08a246caf63a48 (diff) |
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 <iwamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'ryu/lib/rpc.py')
-rw-r--r-- | ryu/lib/rpc.py | 5 |
1 files changed, 3 insertions, 2 deletions
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]) |