diff options
author | Stephen D. Huston <shuston@apache.org> | 2011-10-20 18:42:46 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2011-10-20 18:42:46 +0000 |
commit | 5eb354b338bb8d8fcd35b6ac3fb33f8103e757c3 (patch) | |
tree | f24776684c025fbed6a0431bf3d6811f0a1aae7a /python/qpid/codec010.py | |
parent | 718ff5b34dd1e87eb79fa4c61fec668d1dc33103 (diff) | |
download | qpid-python-5eb354b338bb8d8fcd35b6ac3fb33f8103e757c3.tar.gz |
Merge trunk to QPID-2519 branch
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1186990 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/codec010.py')
-rw-r--r-- | python/qpid/codec010.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/python/qpid/codec010.py b/python/qpid/codec010.py index 0846db6bf7..94a1cd4263 100644 --- a/python/qpid/codec010.py +++ b/python/qpid/codec010.py @@ -17,7 +17,7 @@ # under the License. # -import datetime +import datetime, string from packer import Packer from datatypes import serial, timestamp, RangedSet, Struct, UUID from ops import Compound, PRIMITIVE, COMPOUND @@ -241,15 +241,20 @@ class Codec(Packer): v = sc.read_primitive(type) result[k] = v return result + + def _write_map_elem(self, k, v): + type = self.encoding(v) + sc = StringCodec() + sc.write_str8(k) + sc.write_uint8(type.CODE) + sc.write_primitive(type, v) + return sc.encoded + def write_map(self, m): sc = StringCodec() if m is not None: sc.write_uint32(len(m)) - for k, v in m.items(): - type = self.encoding(v) - sc.write_str8(k) - sc.write_uint8(type.CODE) - sc.write_primitive(type, v) + sc.write(string.joinfields(map(self._write_map_elem, m.keys(), m.values()), "")) self.write_vbin32(sc.encoded) def read_array(self): |