changeset 7:6aa0ae93057c

Streamlined StringIO usage in request.py imported from: moin--main--1.5--patch-8
author Alexander Schremmer <alex@alexanderweb.de.tla>
date Thu, 22 Sep 2005 22:57:36 +0000
parents 2a982e08aee5
children da9701a3facb
files MoinMoin/request.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request.py	Thu Sep 22 22:31:14 2005 +0000
+++ b/MoinMoin/request.py	Thu Sep 22 22:57:36 2005 +0000
@@ -8,7 +8,11 @@
 """
 
 import os, time, sys, cgi
-from cStringIO import StringIO
+try:
+    import cStringIO as StringIO
+except ImportError:
+    import StringIO
+
 from MoinMoin import config, wikiutil, user, error
 from MoinMoin.util import MoinMoinNoFooter, IsWin9x
 import MoinMoin.error
@@ -622,7 +626,6 @@
 
     def redirectedOutput(self, function, *args, **kw):
         """ Redirect output during function, return redirected output """
-        import StringIO
         buffer = StringIO.StringIO()
         self.redirect(buffer)
         try:
@@ -2062,7 +2065,7 @@
             self.hasContentType = False
             
             self.stdin = env['wsgi.input']
-            self.stdout = StringIO()
+            self.stdout = StringIO.StringIO()
             
             self.status = '200 OK'
             self.headers = []
@@ -2088,7 +2091,7 @@
         self.stdout.write(self.encode(data))
     
     def reset_output(self):
-        self.stdout = StringIO()
+        self.stdout = StringIO.StringIO()
     
     def setHttpHeader(self, header):
         if type(header) is unicode: