summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste/gzipper.py5
-rw-r--r--tests/test_gzipper.py10
2 files changed, 7 insertions, 8 deletions
diff --git a/paste/gzipper.py b/paste/gzipper.py
index 21b4164..eca8775 100644
--- a/paste/gzipper.py
+++ b/paste/gzipper.py
@@ -13,8 +13,7 @@ Gzip-encodes the response.
import gzip
from paste.response import header_value, remove_header
from paste.httpheaders import CONTENT_LENGTH
-
-from six.moves import cStringIO as StringIO
+import six
class GzipOutput(object):
pass
@@ -43,7 +42,7 @@ class GzipResponse(object):
def __init__(self, start_response, compress_level):
self.start_response = start_response
self.compress_level = compress_level
- self.buffer = StringIO()
+ self.buffer = six.BytesIO()
self.compressible = False
self.content_length = None
diff --git a/tests/test_gzipper.py b/tests/test_gzipper.py
index 4f929b0..54b7901 100644
--- a/tests/test_gzipper.py
+++ b/tests/test_gzipper.py
@@ -1,11 +1,11 @@
from paste.fixture import TestApp
from paste.gzipper import middleware
import gzip
-from six.moves import cStringIO as StringIO
+import six
def simple_app(environ, start_response):
start_response('200 OK', [('content-type', 'text/plain')])
- return 'this is a test'
+ return [b'this is a test']
wsgi_app = middleware(simple_app)
app = TestApp(wsgi_app)
@@ -14,6 +14,6 @@ def test_gzip():
res = app.get(
'/', extra_environ=dict(HTTP_ACCEPT_ENCODING='gzip'))
assert int(res.header('content-length')) == len(res.body)
- assert res.body != 'this is a test'
- actual = gzip.GzipFile(fileobj=StringIO(res.body)).read()
- assert actual == 'this is a test'
+ assert res.body != b'this is a test'
+ actual = gzip.GzipFile(fileobj=six.BytesIO(res.body)).read()
+ assert actual == b'this is a test'