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

doerwalter at users.sourceforge.net doerwalter at users.sourceforge.net
Thu Mar 31 16:16:33 CEST 2005


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

Modified Files:
      Tag: release24-maint
	register.py 
Log Message:
Backport checkin:
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.7
retrieving revision 1.7.4.1
diff -u -d -r1.7 -r1.7.4.1
--- register.py	18 Jul 2004 06:14:43 -0000	1.7
+++ register.py	31 Mar 2005 14:16:30 -0000	1.7.4.1
@@ -248,7 +248,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")
@@ -261,7 +261,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