Commits

Alexis Metaireau committed 4f4cb7e

python 2 does not have bytes yet

Comments (0)

Files changed (1)

distutils2/util.py

     # http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/
 
     if boundary is None:
-        boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
+        boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
     elif not isinstance(boundary, bytes):
         raise TypeError('boundary must be bytes, not %r' % type(boundary))
 
 
         for value in values:
             l.extend((
-                b'--' + boundary,
-                ('Content-Disposition: form-data; name="%s"' %
-                 key).encode('utf-8'),
-                b'',
-                value.encode('utf-8')))
+                '--' + boundary,
+                ('Content-Disposition: form-data; name="%s"' % key), '', value))
 
     for key, filename, value in files:
         l.extend((
-            b'--' + boundary,
+            '--' + boundary,
             ('Content-Disposition: form-data; name="%s"; filename="%s"' %
-             (key, filename)).encode('utf-8'),
-            b'',
+             (key, filename)),
+            '',
             value))
 
-    l.append(b'--' + boundary + b'--')
-    l.append(b'')
+    l.append('--' + boundary + '--')
+    l.append('')
 
-    body = b'\r\n'.join(l)
-    content_type = b'multipart/form-data; boundary=' + boundary
+    body = '\r\n'.join(l)
+    content_type = 'multipart/form-data; boundary=' + boundary
     return content_type, body
     
 # shutil stuff
         try:
             return readline()
         except StopIteration:
-            return b''
+            return ''
 
     def find_cookie(line):
         try: