summaryrefslogtreecommitdiff
path: root/distutils2/util.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-08-22 21:29:20 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-08-22 21:29:20 +0200
commite847e337597668638ebd94c652b53d7b28a1e6b1 (patch)
tree994cb5bcfc475d1afcb77dfb87d5bc817e2eb84f /distutils2/util.py
parentd6419318593feba52218e0abc1791445658e3978 (diff)
downloaddisutils2-e847e337597668638ebd94c652b53d7b28a1e6b1.tar.gz
python 2 does not have bytes yet
Diffstat (limited to 'distutils2/util.py')
-rw-r--r--distutils2/util.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/distutils2/util.py b/distutils2/util.py
index c9edb63..758f621 100644
--- a/distutils2/util.py
+++ b/distutils2/util.py
@@ -1508,7 +1508,7 @@ def encode_multipart(fields, files, boundary=None):
# 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))
@@ -1520,25 +1520,22 @@ def encode_multipart(fields, files, boundary=None):
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
@@ -2014,7 +2011,7 @@ def detect_encoding(readline):
try:
return readline()
except StopIteration:
- return b''
+ return ''
def find_cookie(line):
try: