diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2004-06-05 12:35:58 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2004-06-05 12:35:58 (GMT) |
commit | 5962f457b48997dbfb8bcb0769b57cd3fab96148 (patch) | |
tree | ae1b5b9b5eb07d7c19b320bf8f493e157d29058b /Lib/xmlrpclib.py | |
parent | b12d97c275a0c448a324c57c68b1fe62eca43bac (diff) | |
download | cpython-5962f457b48997dbfb8bcb0769b57cd3fab96148.zip cpython-5962f457b48997dbfb8bcb0769b57cd3fab96148.tar.gz cpython-5962f457b48997dbfb8bcb0769b57cd3fab96148.tar.bz2 |
[Bug #841757] Patch from /F to allow Unicode strings as struct keys
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r-- | Lib/xmlrpclib.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index 2466e25..e7eb466 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -688,12 +688,15 @@ class Marshaller: self.memo[i] = None dump = self.__dump write("<value><struct>\n") - for k in value.keys(): + for k, v in value.items(): write("<member>\n") if type(k) is not StringType: - raise TypeError, "dictionary key must be string" + if unicode and type(k) is UnicodeType: + k = k.encode(self.encoding) + else: + raise TypeError, "dictionary key must be string" write("<name>%s</name>\n" % escape(k)) - dump(value[k], write) + dump(v, write) write("</member>\n") write("</struct></value>\n") del self.memo[i] |