summaryrefslogtreecommitdiff
path: root/wsgitools/middlewares.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/middlewares.py')
-rw-r--r--wsgitools/middlewares.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index dbf2020..e6ede9d 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -5,12 +5,7 @@ import sys
import cgitb
import binascii
import collections
-# Cannot use io module as it is broken in 2.6.
-# Writing a str to a io.StringIO results in an exception.
-try:
- import cStringIO as io
-except ImportError:
- import StringIO as io
+import io
if sys.version_info[0] >= 3:
def exc_info_for_raise(exc_info):
@@ -60,7 +55,7 @@ __all__.append("NoWriteCallableMiddleware")
class NoWriteCallableMiddleware:
"""This middleware wraps a wsgi application that needs the return value of
C{start_response} function to a wsgi application that doesn't need one by
- writing the data to a C{StringIO} and then making it be the first result
+ writing the data to a C{BytesIO} and then making it be the first result
element."""
def __init__(self, app):
"""Wraps wsgi application app."""
@@ -72,7 +67,7 @@ class NoWriteCallableMiddleware:
"""
assert isinstance(environ, dict)
todo = [None]
- sio = io.StringIO()
+ sio = io.BytesIO()
gotiterdata = False
def write_calleable(data):
assert not gotiterdata