SVN: r23115 - trunk/quixote

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Mon, 10 Nov 2003 13:42:24 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: nascheme
Date: 2003-11-10 13:42:24 -0500 (Mon, 10 Nov 2003)
New Revision: 23115

Modified:
   trunk/quixote/publish.py
Log:
Implement publish_fcgi().  Don't use fcgi module for publish_cgi() since it's
not completely portable.  If you want to use FastCGI, you need to call
publish_fcgi() instead of publish_cgi().


Modified: trunk/quixote/publish.py
===================================================================
--- trunk/quixote/publish.py	2003-11-10 18:24:27 UTC (rev 23114)
+++ trunk/quixote/publish.py	2003-11-10 18:42:24 UTC (rev 23115)
@@ -542,24 +542,31 @@
 
 
     def publish_cgi (self):
-        """publish_cgi() -> None
+        """publish_cgi()
 
-        Entry point from CGI and FCGI scripts; it will repeatedly do the
-        publish() function until there are no more requests (only once for
-        CGI scripts).
+        Entry point from CGI scripts; it will execute the publish function
+        once and return.
         """
-
-        # On Windows sys.stdout is opened in text mode by default
         if sys.platform == "win32":
+            # On Windows sys.stdout is opened in text mode by default
             import msvcrt
             msvcrt.setmode(sys.__stdout__.fileno(), os.O_BINARY)
+        self.publish(sys.__stdin__, sys.__stdout__, sys.__stderr__, os.environ)
 
+    def publish_fcgi (self):
+        """publish_fcgi()
+
+        Entry point from FCGI scripts; it will repeatedly do the publish()
+        function until there are no more requests.  This should also work
+        for CGI scripts but it is not as portable as publish_cgi().
+        """
         while fcgi.isFCGI() and not self.exit_now:
             f = fcgi.FCGI()
             self.publish(f.inp, f.out, f.err, f.env)
             f.Finish()
             if self.config.run_once:
                 break
+        
 
 # class Publisher