From 5c0a3965cdb9cac87d0b0ea773a6276c73a27ba6 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 29 Mar 2009 17:42:48 +0200 Subject: 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. --- wsgitools/scgi/asynchronous.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'wsgitools/scgi/asynchronous.py') 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), -- cgit v1.2.3