[Python-checkins] python/dist/src/Lib/distutils/command register.py, 1.8, 1.9

doerwalter at users.sourceforge.net doerwalter at users.sourceforge.net
Thu Mar 31 15:57:41 CEST 2005


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

Modified Files:
	register.py 
Log Message:
Since PyPI only accepts UTF-8 encoded data now, make sure that the data is
properly encoded and include the encoding in the Content-Type header.


Index: register.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/register.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- register.py	20 Mar 2005 22:19:47 -0000	1.8
+++ register.py	31 Mar 2005 13:57:38 -0000	1.9
@@ -254,7 +254,7 @@
             if type(value) != type([]):
                 value = [value]
             for value in value:
-                value = str(value)
+                value = unicode(value).encode("utf-8")
                 body.write(sep_boundary)
                 body.write('\nContent-Disposition: form-data; name="%s"'%key)
                 body.write("\n\n")
@@ -267,7 +267,7 @@
 
         # build the Request
         headers = {
-            'Content-type': 'multipart/form-data; boundary=%s'%boundary,
+            'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'%boundary,
             'Content-length': str(len(body))
         }
         req = urllib2.Request(self.repository, body, headers)



More information about the Python-checkins mailing list