diff options
-rw-r--r-- | wsgitools/filters.py | 9 | ||||
-rw-r--r-- | wsgitools/middlewares.py | 9 | ||||
-rw-r--r-- | wsgitools/scgi/asynchronous.py | 9 |
3 files changed, 12 insertions, 15 deletions
diff --git a/wsgitools/filters.py b/wsgitools/filters.py index 8f4f6a5..7062357 100644 --- a/wsgitools/filters.py +++ b/wsgitools/filters.py @@ -10,13 +10,12 @@ __all__ = [] import sys import time import gzip +# Cannot use io module as it is broken in 2.6. +# Writing a str to a io.StringIO results in an exception. try: - import io + import cStringIO as io except ImportError: - try: - import cStringIO as io - except ImportError: - import StringIO as io + import StringIO as io try: next diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py index 38e2e67..09d4cfe 100644 --- a/wsgitools/middlewares.py +++ b/wsgitools/middlewares.py @@ -5,13 +5,12 @@ import sys import cgitb import binascii from wsgitools.filters import CloseableList, CloseableIterator +# Cannot use io module as it is broken in 2.6. +# Writing a str to a io.StringIO results in an exception. try: - import io + import cStringIO as io except ImportError: - try: - import cStringIO as io - except ImportError: - import StringIO as io + import StringIO as io try: next except NameError: diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py index b51e7ca..ecc27fb 100644 --- a/wsgitools/scgi/asynchronous.py +++ b/wsgitools/scgi/asynchronous.py @@ -3,13 +3,12 @@ __all__ = [] import asyncore import socket import sys +# Cannot use io module as it is broken in 2.6. +# Writing a str to a io.StringIO results in an exception. try: - import io + import cStringIO as io except ImportError: - try: - import cStringIO as io - except ImportError: - import StringIO as io + import StringIO as io class SCGIConnection(asyncore.dispatcher): """SCGI connection class used by L{SCGIServer}.""" |