[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - IRequestFactory.py:1.1.4.1 PublisherServers.py:1.1.2.9
Jim Fulton
jim@zope.com
Tue, 26 Mar 2002 16:26:00 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv7731/Zope/Server
Modified Files:
Tag: Zope-3x-branch
PublisherServers.py
Added Files:
Tag: Zope-3x-branch
IRequestFactory.py
Log Message:
Merged the publication refactoring branch into the main branch.
Also renamed:
browser_reaverse -> publishTraverse
browser_default -> browserDefault
=== Added File Zope3/lib/python/Zope/Server/IRequestFactory.py ===
##############################################################################
#
# 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
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
Revision information:
$Id: IRequestFactory.py,v 1.1.4.1 2002/03/26 21:26:00 jim Exp $
"""
from Interface import Interface
class IRequestFactory:
def __call__(input_stream, output_steam, environment):
"""Create a request object *with* a publication
Factories that support multiple request/response/publication
types may look at the environment (headers) or the stream to
determine which request/response/publication to create.
"""
=== Zope3/lib/python/Zope/Server/PublisherServers.py 1.1.2.8 => 1.1.2.9 ===
env = self.create_environment()
instream = self.request_data.getBodyStream()
- resp = HTTPResponse(server.response_payload, self, self)
- req = HTTPRequest(server.request_payload, resp, instream, env)
- publish(req)
+
+ request = server.request_factory(instream, self, env)
+ response = request.getResponse()
+ response.setHeaderOutput(self)
+ publish(request)
def create_environment(self):
request_data = self.request_data
@@ -105,8 +107,7 @@
channel_class = PublisherHTTPChannel
- def __init__(self, request_payload, response_payload, *args, **kw):
- self.request_payload = request_payload
- self.response_payload = response_payload
+ def __init__(self, request_factory, *args, **kw):
+ self.request_factory = request_factory
HTTPServer.__init__(self, *args, **kw)