[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - Adjustments.py:1.1.2.3.12.1 Buffers.py:1.1.2.2.12.1 Chunking.py:1.1.2.3.10.1 DualModeChannel.py:1.1.2.2.12.1 HTTPServer.py:1.1.2.16.12.1 IHeaderOutput.py:1.1.2.2.12.1 IRequestFactory.py:1.1.4.1.4.1 IStreamConsumer.py:1.1.2.2.8.1 ITask.py:1.1.2.2.12.1 ITaskDispatcher.py:1.1.2.1.12.1 PublisherServers.py:1.1.2.10.4.1 ServerBase.py:1.1.2.2.8.1 TaskThreads.py:1.1.2.7.12.1 Utilities.py:1.1.2.2.12.1 ZLogIntegration.py:1.1.2.2.12.1 __init__.py:1.1.2.4.12.1
Gary Poster
garyposter@earthlink.net
Tue, 2 Apr 2002 21:18:56 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv29027/Server
Modified Files:
Tag: gary-pre_create_views-branch
Adjustments.py Buffers.py Chunking.py DualModeChannel.py
HTTPServer.py IHeaderOutput.py IRequestFactory.py
IStreamConsumer.py ITask.py ITaskDispatcher.py
PublisherServers.py ServerBase.py TaskThreads.py Utilities.py
ZLogIntegration.py __init__.py
Log Message:
license changes thanks to license script. Trying a smaller chunk since the larger commits appear to be crashing the server <blush>
=== Zope3/lib/python/Zope/Server/Adjustments.py 1.1.2.3 => 1.1.2.3.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,7 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
+#
+##############################################################################
from medusa.test import max_sockets
=== Zope3/lib/python/Zope/Server/Buffers.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
try:
from cStringIO import StringIO
except ImportError:
=== Zope3/lib/python/Zope/Server/Chunking.py 1.1.2.3 => 1.1.2.3.10.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,8 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from Utilities import find_double_newline
from IStreamConsumer import IStreamConsumer
=== Zope3/lib/python/Zope/Server/DualModeChannel.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
+#
+##############################################################################
import asyncore
import socket
from time import time
@@ -85,9 +89,6 @@
self.creation_time = time()
asyncore.dispatcher.__init__(self, conn)
- def get_sync_streams(self):
- return synchronous_streams(self)
-
#
# ASYNCHRONOUS METHODS
#
@@ -157,7 +158,7 @@
# SYNCHRONOUS METHODS
#
- def sync_write(self, data):
+ def write(self, data):
if data:
self.outbuf.append(data)
while len(self.outbuf) >= self.adj.send_bytes:
@@ -167,7 +168,7 @@
if not self._flush_some():
break
- def sync_flush(self):
+ def flush(self):
"""
Pauses the application while outbuf is flushed.
Normally not a good thing to do.
@@ -277,17 +278,17 @@
# SYNCHRONOUS METHODS
#
- def sync_write(self, data):
+ def write(self, data):
self._writelock_acquire()
try:
- DualModeChannel.sync_write(self, data)
+ DualModeChannel.write(self, data)
finally:
self._writelock_release()
- def sync_flush(self):
+ def flush(self):
self._writelock_acquire()
try:
- DualModeChannel.sync_flush(self)
+ DualModeChannel.flush(self)
finally:
self._writelock_release()
=== Zope3/lib/python/Zope/Server/HTTPServer.py 1.1.2.16 => 1.1.2.16.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
-# Version 1.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
+#
+##############################################################################
"""
This server uses asyncore to accept connections and do initial
processing but threads to do work.
@@ -185,15 +189,15 @@
channel = self.channel
if not self.wrote_header:
rh = self.buildResponseHeader()
- channel.sync_write(rh)
+ channel.write(rh)
self.bytes_written += len(rh)
self.wrote_header = 1
if data:
- channel.sync_write(data)
+ channel.write(data)
self.bytes_written += len(data)
def flush(self):
- self.channel.sync_flush()
+ self.channel.flush()
=== Zope3/lib/python/Zope/Server/IHeaderOutput.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,8 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from Interface import Interface
=== Zope3/lib/python/Zope/Server/IRequestFactory.py 1.1.4.1 => 1.1.4.1.4.1 ===
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
=== Zope3/lib/python/Zope/Server/IStreamConsumer.py 1.1.2.2 => 1.1.2.2.8.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from Interface import Interface
from Interface.Attribute import Attribute
=== Zope3/lib/python/Zope/Server/ITask.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,8 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from Interface import Interface
=== Zope3/lib/python/Zope/Server/ITaskDispatcher.py 1.1.2.1 => 1.1.2.1.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from Interface import Interface
class ITaskDispatcher (Interface):
=== Zope3/lib/python/Zope/Server/PublisherServers.py 1.1.2.10 => 1.1.2.10.4.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
from os import path as ospath
from HTTPServer import HTTPTask, HTTPServerChannel, HTTPServer
=== Zope3/lib/python/Zope/Server/ServerBase.py 1.1.2.2 => 1.1.2.2.8.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
import os
import asyncore
import socket
@@ -80,7 +83,7 @@
proto_request = None # A request parser instance
ready_requests = None # A list
last_activity = 0 # Time of last activity
- running_tasks = 0 # boolean
+ running_tasks = 0 # boolean: true when any task is being executed
#
# ASYNCHRONOUS METHODS (incl. __init__)
@@ -152,7 +155,7 @@
data = data[n:]
def queue_request(self, req):
- """Queues a request to be processed in sequence by a task.
+ """Queues a request to be processed in sequence.
"""
do_now = 0
running_lock.acquire()
@@ -171,8 +174,7 @@
finally:
running_lock.release()
if do_now:
- self.set_sync()
- self.create_task(req)
+ self.process_request(req)
def handle_error(self):
"""Handles program errors (not communication errors)
@@ -196,7 +198,7 @@
#
def end_task(self, close):
- """Called at the end of a task, may launch another task.
+ """Called at the end of a task and may launch another task.
"""
if close:
self.close_when_done()
@@ -208,12 +210,13 @@
if rr:
new_req = rr.pop(0)
else:
+ # No requests to service.
self.running_tasks = 0
finally:
running_lock.release()
if new_req:
# Respond to the next request.
- self.create_task(new_req)
+ self.process_request(new_req)
else:
# Wait for another request on this connection.
self.set_async()
@@ -222,11 +225,12 @@
# BOTH MODES
#
- def create_task(self, req):
+ def process_request(self, req):
"""Creates a new task and queues it for execution.
The task may get executed in another thread.
"""
+ self.set_sync()
task = self.task_class(self, req)
self.server.addTask(task)
=== Zope3/lib/python/Zope/Server/TaskThreads.py 1.1.2.7 => 1.1.2.7.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,8 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
import sys
from Queue import Queue, Empty
from thread import allocate_lock, start_new_thread
=== Zope3/lib/python/Zope/Server/Utilities.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
-
+#
+##############################################################################
def find_double_newline(s):
"""Returns the position just after a double newline in the given string."""
pos1 = s.find('\n\r\n') # One kind of double newline
=== Zope3/lib/python/Zope/Server/ZLogIntegration.py 1.1.2.2 => 1.1.2.2.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,6 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
"""Makes asyncore log to zLOG.
"""
=== Zope3/lib/python/Zope/Server/__init__.py 1.1.2.4 => 1.1.2.4.12.1 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,7 +9,8 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-
+#
+##############################################################################
"""
Zope.Server package.
"""