[New-bugs-announce] [issue7748] unicode supported in distutils register but not distutils upload

dholth report at bugs.python.org
Thu Jan 21 21:23:12 CET 2010


New submission from dholth <dholth at fastmail.fm>:

# -*- encoding: utf-8 -*-
# Will not 'python setup.py upload':
setup(name='acute_e', version='0.1', description=u'é')

It looks like someone fixed this for register but forgot to copy it into upload:

+        # Build up the MIME payload for the POST data
         boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
         sep_boundary = '\n--' + boundary
         end_boundary = sep_boundary + '--'
         body = StringIO.StringIO()
         for key, value in data.items():
             # handle multiple entries for the same name
-            if type(value) not in (type([]), type( () )):
+            if type(value) != type([]):
                 value = [value]
             for value in value:
-                value = unicode(value).encode("utf-8")
+                if type(value) is tuple:
+                    fn = ';filename="%s"' % value[0]
+                    value = value[1]
+                else:
+                    fn = ""
+                value = str(value)
                 body.write(sep_boundary)
                 body.write('\nContent-Disposition: form-data; name="%s"'%key)
+                body.write(fn)
                 body.write("\n\n")
                 body.write(value)
                 if value and value[-1] == '\r':

----------
assignee: tarek
components: Distutils
messages: 98109
nosy: dholth, tarek
severity: normal
status: open
title: unicode supported in distutils register but not distutils upload
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7748>
_______________________________________


More information about the New-bugs-announce mailing list