[Python-checkins] python/dist/src/Lib xmlrpclib.py,1.32,1.33

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Sat Jun 5 08:36:01 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15283

Modified Files:
	xmlrpclib.py 
Log Message:
[Bug #841757] Patch from /F to allow Unicode strings as struct keys

Index: xmlrpclib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** xmlrpclib.py	2 Nov 2003 09:47:05 -0000	1.32
--- xmlrpclib.py	5 Jun 2004 12:35:58 -0000	1.33
***************
*** 689,698 ****
          dump = self.__dump
          write("<value><struct>\n")
!         for k in value.keys():
              write("<member>\n")
              if type(k) is not StringType:
!                 raise TypeError, "dictionary key must be string"
              write("<name>%s</name>\n" % escape(k))
!             dump(value[k], write)
              write("</member>\n")
          write("</struct></value>\n")
--- 689,701 ----
          dump = self.__dump
          write("<value><struct>\n")
!         for k, v in value.items():
              write("<member>\n")
              if type(k) is not StringType:
!                 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(v, write)
              write("</member>\n")
          write("</struct></value>\n")




More information about the Python-checkins mailing list