[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - HTTPResponse.py:1.1.2.5 HTTPServer.py:1.1.2.5
Shane Hathaway
shane@digicool.com
Mon, 19 Nov 2001 15:25:01 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv21252/lib/python/Zope/Server
Modified Files:
Tag: Zope-3x-branch
HTTPResponse.py HTTPServer.py
Log Message:
Reoriented payload objects. They now return the publication object.
Also made Publish.py easier to understand.
=== Zope3/lib/python/Zope/Server/HTTPResponse.py 1.1.2.4 => 1.1.2.5 ===
-def make_response(request, headers):
+def make_response(response_payload, request, headers):
"Simple http response factory"
# should this be integrated into the HTTPResponse constructor?
- response=ZServerHTTPResponse(ChannelPipe(request))
+ response=ZServerHTTPResponse(response_payload, ChannelPipe(request))
response._http_version=request.version
response._http_connection=(
http_server.get_header(http_server.CONNECTION, request.header)).lower()
=== Zope3/lib/python/Zope/Server/HTTPServer.py 1.1.2.4 => 1.1.2.5 ===
"A medusa style handler for zhttp_server"
- def __init__ (self, publication, uri_base=None, env=None):
+ def __init__ (self, request_payload, response_payload,
+ uri_base=None, env=None):
"""Creates a zope_handler
- publication -- a implementation of IPublication
+ request_payload -- an implementation of IRequestPayload
+ response_payload -- an implementation of IResponsePayload
uri_base -- string, the base uri of the published module
defaults to '/<module name>' if not given.
env -- dictionary, environment variables to be overridden.
Replaces standard variables with supplied ones.
"""
- self.publication = publication
+ self.request_payload = request_payload
+ self.response_payload = response_payload
self.env_override=env or {}
self.hits = counter.counter()
# if uri_base is unspecified, assume it
@@ -219,10 +222,10 @@
#DebugLogger.log('I', id(request), s)
env=self.get_environment(request)
- zresponse=make_response(request,env)
- zrequest=HTTPRequest(sin, env, zresponse)
+ zresponse=make_response(self.response_payload, request, env)
+ zrequest=HTTPRequest(self.request_payload, sin, env, zresponse)
request.channel.current_request=None
- request.channel.queue.append((self.publication, zrequest))
+ request.channel.queue.append(zrequest)
request.channel.work()
def status(self):
@@ -231,7 +234,7 @@
<ul>
<li><b>Published Module:</b> %s
<li><b>Hits:</b> %s
- </ul>""" %(self.publication, self.hits)
+ </ul>""" %(`self.request_payload`, self.hits)
)
@@ -264,9 +267,9 @@
if not self.working:
if self.queue:
self.working=1
- try: publication, request = self.queue.pop(0)
+ try: request = self.queue.pop(0)
except: return
- handle(publication, request)
+ handle(request)
def close(self):
self.closed=1