diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-18 18:11:48 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-18 18:11:48 (GMT) |
commit | 229011d949f40c898ca4e146f3120af326a3f40d (patch) | |
tree | a804e7c1bd83270b459a55d9cc104fcb805bbefd /Lib/packaging/tests/pypi_server.py | |
parent | 41479450ece3bb5c01a49b5efd5d17021ca401ec (diff) | |
download | cpython-229011d949f40c898ca4e146f3120af326a3f40d.zip cpython-229011d949f40c898ca4e146f3120af326a3f40d.tar.gz cpython-229011d949f40c898ca4e146f3120af326a3f40d.tar.bz2 |
Make a number of small changes to ease the backport to distutils2
Diffstat (limited to 'Lib/packaging/tests/pypi_server.py')
-rw-r--r-- | Lib/packaging/tests/pypi_server.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/packaging/tests/pypi_server.py b/Lib/packaging/tests/pypi_server.py index 41bf9c4..72cf8be 100644 --- a/Lib/packaging/tests/pypi_server.py +++ b/Lib/packaging/tests/pypi_server.py @@ -40,6 +40,7 @@ from xmlrpc.server import SimpleXMLRPCServer from packaging.tests import unittest + PYPI_DEFAULT_STATIC_PATH = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'pypiserver') @@ -219,7 +220,7 @@ class PyPIRequestHandler(SimpleHTTPRequestHandler): relative_path += "index.html" if relative_path.endswith('.tar.gz'): - with open(fs_path + relative_path, 'br') as file: + with open(fs_path + relative_path, 'rb') as file: data = file.read() headers = [('Content-type', 'application/x-gtar')] else: @@ -260,8 +261,8 @@ class PyPIRequestHandler(SimpleHTTPRequestHandler): self.send_header(header, value) self.end_headers() - if type(data) is str: - data = data.encode() + if isinstance(data, str): + data = data.encode('utf-8') self.wfile.write(data) |