mercurial/hgweb/wsgicgi.py
changeset 2558 1120302009d7
parent 2506 d0db3462d568
child 3673 eb0b4a2d70a9
--- a/mercurial/hgweb/wsgicgi.py	Mon Jul 03 00:23:58 2006 -0300
+++ b/mercurial/hgweb/wsgicgi.py	Mon Jul 03 00:33:19 2006 -0300
@@ -27,6 +27,7 @@
 
     headers_set = []
     headers_sent = []
+    out = sys.stdout
 
     def write(data):
         if not headers_set:
@@ -35,13 +36,13 @@
         elif not headers_sent:
              # Before the first output, send the stored headers
              status, response_headers = headers_sent[:] = headers_set
-             sys.stdout.write('Status: %s\r\n' % status)
+             out.write('Status: %s\r\n' % status)
              for header in response_headers:
-                 sys.stdout.write('%s: %s\r\n' % header)
-             sys.stdout.write('\r\n')
+                 out.write('%s: %s\r\n' % header)
+             out.write('\r\n')
 
-        sys.stdout.write(data)
-        sys.stdout.flush()
+        out.write(data)
+        out.flush()
 
     def start_response(status,response_headers,exc_info=None):
         if exc_info: