summaryrefslogtreecommitdiff
path: root/wsgitools/scgi/asynchronous.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2009-03-29 17:42:48 +0200
committerHelmut Grohne <helmut@subdivi.de>2009-03-29 17:42:48 +0200
commit5c0a3965cdb9cac87d0b0ea773a6276c73a27ba6 (patch)
tree56619fbd0631ae08e01adca15e2994c689dfe8b4 /wsgitools/scgi/asynchronous.py
parentac99754f5e68f3731b7bdd7c8070c58346983bf4 (diff)
downloadwsgitools-5c0a3965cdb9cac87d0b0ea773a6276c73a27ba6.tar.gz
quite some changes for py3
These changes introduce some compatibility code. They don't make wsgitools usable with Python 3.0, but they also don't break compatibility with Python 2.5.
Diffstat (limited to 'wsgitools/scgi/asynchronous.py')
-rw-r--r--wsgitools/scgi/asynchronous.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py
index 9fedb87..33d5130 100644
--- a/wsgitools/scgi/asynchronous.py
+++ b/wsgitools/scgi/asynchronous.py
@@ -4,9 +4,16 @@ import asyncore
import socket
import sys
try:
- import cStringIO as StringIO
+ import io
except ImportError:
- import StringIO
+ try:
+ import cStringIO as io
+ except ImportError:
+ import StringIO as io
+try:
+ long
+except NameError:
+ long = int
class SCGIConnection(asyncore.dispatcher):
"""SCGI connection class used by L{SCGIServer}."""
@@ -32,7 +39,7 @@ class SCGIConnection(asyncore.dispatcher):
self.wsgihandler = None # wsgi application iterator
self.outheaders = () # headers to be sent
# () -> unset, (..,..) -> set, True -> sent
- self.body = StringIO.StringIO() # request body
+ self.body = io.StringIO() # request body
def _wsgi_headers(self):
return {"wsgi.version": (1, 0),