summaryrefslogtreecommitdiff
path: root/python/qpid/codec.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-03-16 22:54:11 +0000
committerAlan Conway <aconway@apache.org>2007-03-16 22:54:11 +0000
commit15256f1f40f96392028f6182cecf29ff334dbe72 (patch)
tree3c443c2444ee44d42132bbf164d5ee2746beeda8 /python/qpid/codec.py
parent70e06534778acde7faae8298775857e5a0c56b5a (diff)
downloadqpid-python-15256f1f40f96392028f6182cecf29ff334dbe72.tar.gz
Merged revisions 500305 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9 ........ r500305 | gsim | 2007-01-26 13:51:21 -0500 (Fri, 26 Jan 2007) | 3 lines Updates to use message class in place of basic. ........ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@519171 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/codec.py')
-rw-r--r--python/qpid/codec.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/python/qpid/codec.py b/python/qpid/codec.py
index d8617c2937..205405894a 100644
--- a/python/qpid/codec.py
+++ b/python/qpid/codec.py
@@ -157,14 +157,15 @@ class Codec:
def encode_table(self, tbl):
enc = StringIO()
codec = Codec(enc)
- for key, value in tbl.items():
- codec.encode_shortstr(key)
- if isinstance(value, basestring):
- codec.write("S")
- codec.encode_longstr(value)
- else:
- codec.write("I")
- codec.encode_long(value)
+ if tbl:
+ for key, value in tbl.items():
+ codec.encode_shortstr(key)
+ if isinstance(value, basestring):
+ codec.write("S")
+ codec.encode_longstr(value)
+ else:
+ codec.write("I")
+ codec.encode_long(value)
s = enc.getvalue()
self.encode_long(len(s))
self.write(s)