[Zope3-checkins] CVS: Zope3/src/zope/server - dualmodechannel.py:1.4 fixedstreamreceiver.py:1.3 serverbase.py:1.3 serverchannelbase.py:1.3 taskthreads.py:1.4

Steve Alexander steve@cat-box.net
Wed, 4 Jun 2003 04:41:03 -0400


Update of /cvs-repository/Zope3/src/zope/server
In directory cvs.zope.org:/tmp/cvs-serv23057/src/zope/server

Modified Files:
	dualmodechannel.py fixedstreamreceiver.py serverbase.py 
	serverchannelbase.py taskthreads.py 
Log Message:
New style implements(), fixed up some formatting.


=== Zope3/src/zope/server/dualmodechannel.py 1.3 => 1.4 ===
--- Zope3/src/zope/server/dualmodechannel.py:1.3	Wed Apr  9 05:49:35 2003
+++ Zope3/src/zope/server/dualmodechannel.py	Wed Jun  4 04:40:32 2003
@@ -30,7 +30,6 @@
     selecttrigger.the_trigger = selecttrigger.Trigger()
 
 
-
 class DualModeChannel(asyncore.dispatcher):
     """Channel that switches between asynchronous and synchronous mode.
 
@@ -41,8 +40,6 @@
     the main loop.
     """
 
-    __implements__ = asyncore.dispatcher.__implements__
-
     # will_close is set to 1 to close the socket.
     will_close = 0
 
@@ -208,7 +205,7 @@
 allocate_lock = None
 
 
-class SimultaneousModeChannel (DualModeChannel):
+class SimultaneousModeChannel(DualModeChannel):
     """Layer on top of DualModeChannel that allows communication in
     both the main thread and other threads at the same time.
 
@@ -216,9 +213,6 @@
     helper.  The asynchronous callbacks empty the output buffer
     and fill the input buffer.
     """
-
-    __implements__ = asyncore.dispatcher.__implements__
-
 
     def __init__(self, conn, addr, adj=None):
         global allocate_lock


=== Zope3/src/zope/server/fixedstreamreceiver.py 1.2 => 1.3 ===
--- Zope3/src/zope/server/fixedstreamreceiver.py:1.2	Wed Dec 25 09:15:23 2002
+++ Zope3/src/zope/server/fixedstreamreceiver.py	Wed Jun  4 04:40:32 2003
@@ -17,11 +17,12 @@
 """
 
 from zope.server.interfaces import IStreamConsumer
+from zope.interface import implements
 
 
 class FixedStreamReceiver:
 
-    __implements__ = IStreamConsumer
+    implements(IStreamConsumer)
 
     # See IStreamConsumer
     completed = 0


=== Zope3/src/zope/server/serverbase.py 1.2 => 1.3 ===
--- Zope3/src/zope/server/serverbase.py:1.2	Wed Dec 25 09:15:23 2002
+++ Zope3/src/zope/server/serverbase.py	Wed Jun  4 04:40:32 2003
@@ -21,15 +21,15 @@
 import socket
 
 from zope.server.adjustments import default_adj
-
 from zope.server.interfaces import IServer
+from zope.interface import implements
 
 
 class ServerBase(asyncore.dispatcher, object):
     """Async. server base for launching derivatives of ServerChannelBase.
     """
 
-    __implements__ = asyncore.dispatcher.__implements__, IServer
+    implements(IServer)
 
     channel_class = None    # Override with a channel class.
     SERVER_IDENT = 'zope.server.serverbase'  # Override.


=== Zope3/src/zope/server/serverchannelbase.py 1.2 => 1.3 ===
--- Zope3/src/zope/server/serverchannelbase.py:1.2	Wed Dec 25 09:15:23 2002
+++ Zope3/src/zope/server/serverchannelbase.py	Wed Jun  4 04:40:32 2003
@@ -21,6 +21,7 @@
 import sys
 import asyncore
 from thread import allocate_lock
+from zope.interface import implements
 
 # Enable ZOPE_SERVER_SIMULT_MODE to enable experimental
 # simultaneous channel mode, which may improve or degrade
@@ -41,8 +42,7 @@
     """Base class for a high-performance, mixed-mode server-side channel.
     """
 
-    __implements__ = ChannelBaseClass.__implements__, IServerChannel
-
+    implements(IServerChannel)
 
     parser_class = None       # Subclasses must provide a parser class
     task_class = None         # ... and a task class.
@@ -66,14 +66,12 @@
         self.last_activity = t = self.creation_time
         self.check_maintenance(t)
 
-
     def add_channel(self, map=None):
         """This hook keeps track of opened HTTP channels.
         """
         ChannelBaseClass.add_channel(self, map)
         self.__class__.active_channels[self._fileno] = self
 
-
     def del_channel(self, map=None):
         """This hook keeps track of closed HTTP channels.
         """
@@ -83,7 +81,6 @@
         if fd in ac:
             del ac[fd]
 
-
     def check_maintenance(self, now):
         """Performs maintenance if necessary.
         """
@@ -93,13 +90,11 @@
         ncc[0] = now + self.adj.cleanup_interval
         self.maintenance()
 
-
     def maintenance(self):
         """Kills off dead connections.
         """
         self.kill_zombies()
 
-
     def kill_zombies(self):
         """Closes connections that have not had any activity in a while.
 
@@ -112,7 +107,6 @@
                 channel.last_activity < cutoff):
                 channel.close()
 
-
     def received(self, data):
         """Receive input asynchronously and send requests to
         receivedCompleteRequest().
@@ -134,7 +128,6 @@
                 break
             data = data[n:]
 
-
     def receivedCompleteRequest(self, req):
         """If there are tasks running or requests on hold, queue
         the request, otherwise execute it.
@@ -160,7 +153,6 @@
             if task is not None:
                 self.start_task(task)
 
-
     def start_task(self, task):
         """Starts the given task.
 
@@ -174,7 +166,6 @@
         self.set_sync()
         self.server.addTask(task)
 
-
     def handle_error(self):
         """Handles program errors (not communication errors)
         """
@@ -183,7 +174,6 @@
             raise t, v
         asyncore.dispatcher.handle_error(self)
 
-
     def handle_comm_error(self):
         """Handles communication errors (not program errors)
         """
@@ -193,7 +183,6 @@
             # Ignore socket errors.
             self.close()
 
-
     #
     # SYNCHRONOUS METHODS
     #
@@ -232,7 +221,6 @@
                 # Idle -- Wait for another request on this connection.
                 self.set_async()
                 break
-
 
     #
     # BOTH MODES


=== Zope3/src/zope/server/taskthreads.py 1.3 => 1.4 ===
--- Zope3/src/zope/server/taskthreads.py:1.3	Wed Apr  9 05:49:35 2003
+++ Zope3/src/zope/server/taskthreads.py	Wed Jun  4 04:40:32 2003
@@ -14,11 +14,12 @@
 import logging
 
 from zope.server.interfaces import ITaskDispatcher
+from zope.interface import implements
 
 
 class ThreadedTaskDispatcher:
 
-    __implements__ = ITaskDispatcher
+    implements(ITaskDispatcher)
 
     stop_count = 0  # Number of threads that will stop soon.