[Checkins] SVN: Zope/branches/gsoc-python-2.5/lib/python/ZServer/ - Temporary workaround for new asyncore in Python 2.6. Need to clean this up

Sidnei da Silva sidnei at enfoldsystems.com
Fri Oct 10 11:05:44 EDT 2008


Log message for revision 91981:
   - Temporary workaround for new asyncore in Python 2.6. Need to clean this up

Changed:
  U   Zope/branches/gsoc-python-2.5/lib/python/ZServer/HTTPServer.py
  U   Zope/branches/gsoc-python-2.5/lib/python/ZServer/medusa/http_server.py

-=-
Modified: Zope/branches/gsoc-python-2.5/lib/python/ZServer/HTTPServer.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/ZServer/HTTPServer.py	2008-10-10 15:05:39 UTC (rev 91980)
+++ Zope/branches/gsoc-python-2.5/lib/python/ZServer/HTTPServer.py	2008-10-10 15:05:44 UTC (rev 91981)
@@ -45,7 +45,8 @@
 from ZPublisher.HTTPRequest import HTTPRequest
 from App.config import getConfiguration
 
-from medusa.http_server import http_server,get_header, http_channel, VERSION_STRING
+from medusa.http_server import http_server, get_header
+from medusa.http_server import fifo, http_channel, VERSION_STRING
 import asyncore
 from medusa import counter, producers
 from medusa.test import  max_sockets
@@ -334,6 +335,10 @@
 
     def __init__(self, server, conn, addr):
         http_channel.__init__(self, server, conn, addr)
+        if isinstance(self.producer_fifo, fifo):
+            self.producer_fifo_push = self.producer_fifo.push
+        else:
+            self.producer_fifo_push = self.producer_fifo.append
         requestCloseOnExec(conn)
         self.queue=[]
         self.working=0
@@ -345,7 +350,7 @@
         # producers by default
         if self.closed:
             return
-        self.producer_fifo.push(producer)
+        self.producer_fifo_push(producer)
         if send: self.initiate_send()
 
     push_with_producer=push

Modified: Zope/branches/gsoc-python-2.5/lib/python/ZServer/medusa/http_server.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/ZServer/medusa/http_server.py	2008-10-10 15:05:39 UTC (rev 91980)
+++ Zope/branches/gsoc-python-2.5/lib/python/ZServer/medusa/http_server.py	2008-10-10 15:05:44 UTC (rev 91981)
@@ -528,25 +528,25 @@
                     # no handlers, so complain
             r.error (404)
             
-    def writable (self):
-            # this is just the normal async_chat 'writable', here for comparison
-        return self.ac_out_buffer or len(self.producer_fifo)
+    #def writable (self):
+    #        # this is just the normal async_chat 'writable', here for comparison
+    #    return self.ac_out_buffer or len(self.producer_fifo)
         
-    def writable_for_proxy (self):
-            # this version of writable supports the idea of a 'stalled' producer
-            # [i.e., it's not ready to produce any output yet] This is needed by
-            # the proxy, which will be waiting for the magic combination of
-            # 1) hostname resolved
-            # 2) connection made
-            # 3) data available.
-        if self.ac_out_buffer:
-            return 1
-        elif len(self.producer_fifo):
-            p = self.producer_fifo.first()
-            if hasattr (p, 'stalled'):
-                return not p.stalled()
-            else:
-                return 1
+    #def writable_for_proxy (self):
+    #        # this version of writable supports the idea of a 'stalled' producer
+    #        # [i.e., it's not ready to produce any output yet] This is needed by
+    #        # the proxy, which will be waiting for the magic combination of
+    #        # 1) hostname resolved
+    #        # 2) connection made
+    #        # 3) data available.
+    #    if self.ac_out_buffer:
+    #        return 1
+    #    elif len(self.producer_fifo):
+    #        p = self.producer_fifo.first()
+    #        if hasattr (p, 'stalled'):
+    #            return not p.stalled()
+    #        else:
+    #            return 1
                 
                 # ===========================================================================
                 #						 HTTP Server Object



More information about the Checkins mailing list