[Python-checkins] distutils2: python 2 does not have bytes yet
alexis.metaireau
python-checkins at python.org
Mon Aug 22 21:56:21 CEST 2011
http://hg.python.org/distutils2/rev/4f4cb7e8c0c4
changeset: 1125:4f4cb7e8c0c4
user: Alexis Metaireau <alexis at notmyidea.org>
date: Mon Aug 22 21:29:20 2011 +0200
summary:
python 2 does not have bytes yet
files:
distutils2/util.py | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/distutils2/util.py b/distutils2/util.py
--- a/distutils2/util.py
+++ b/distutils2/util.py
@@ -1508,7 +1508,7 @@
# 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 @@
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 @@
try:
return readline()
except StopIteration:
- return b''
+ return ''
def find_cookie(line):
try:
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list