[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.1.2.12 BaseResponse.py:1.1.2.7 Publish.py:1.1.2.10 minitest.py:1.1.2.5

Shane Hathaway shane@digicool.com
Wed, 21 Nov 2001 19:23:10 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv31156/Publisher

Modified Files:
      Tag: Zope-3x-branch
	BaseRequest.py BaseResponse.py Publish.py minitest.py 
Log Message:
- Created new HTTP server based on Medusa and ZServer.

- Made some corresponding changes to Zope.Publication.

- Got minitest working again.


=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.11 => 1.1.2.12 ===
     _key_handlers = {}
 
-    def getRequest(self, default):
+    def getRequest(self, default=None):
         return self
     _key_handlers['REQUEST'] = getRequest
+
+    def getResponse(self, default=None):
+        return self.response
+    _key_handlers['RESPONSE'] = getResponse
 
     def getURL(self, default=None):
         return self.URL


=== Zope3/lib/python/Zope/Publisher/BaseResponse.py 1.1.2.6 => 1.1.2.7 ===
     #_error_format='text/plain'
     
-    def __init__(self, outstream, body='', headers=None,
-                 status=None, cookies=None):
+    def __init__(self, outstream):
         self.outstream = outstream
-        if headers is None:
-            headers = {}
-        self.headers = headers
-        self.setStatus(status)
-        if body:
-            self.setBody(body)
-        if cookies is None:
-            cookies = {}
-        self.cookies = cookies
+        self.headers = {}
+        self.cookies = {}
 
     def setDebugMode(self, d):
         self.debug_mode = d


=== Zope3/lib/python/Zope/Publisher/Publish.py 1.1.2.9 => 1.1.2.10 ===
         publication.handleException(request, exc_info, allow_retry)
     else:
-        request.response.handleException(request, exc_info)
+        request.response.handleException(exc_info)
     return exc_info
 
 


=== Zope3/lib/python/Zope/Publisher/minitest.py 1.1.2.4 => 1.1.2.5 ===
 from Zope.Publisher.HTTP.HTTPRequest import HTTPRequest
 from Zope.Publisher.HTTP.HTTPResponse import HTTPResponse
+from Zope.Publisher.HTTP.BrowserPayload import BrowserRequestPayload, \
+     BrowserResponsePayload
 
 class c:
     " "
@@ -26,14 +28,18 @@
 ob.x = c()
 ob.x.y = c()
 
-response = HTTPResponse(sys.stdout)
+publication = DefaultPublication(ob)
+req_p = BrowserRequestPayload(publication)
+resp_p = BrowserResponsePayload()
+
+response = HTTPResponse(resp_p, sys.stdout)
 environ = {
     'SERVER_NAME': 'test',
     'PATH_INFO': sys.argv[1]
     }
-request = HTTPRequest(sys.stdin, environ, response)
-publication = DefaultPublication(ob)
-publish(publication, request)
+request = HTTPRequest(req_p, sys.stdin, environ, response)
+
+publish(request)
 
 # bogus speed test ;-)
 
@@ -46,13 +52,13 @@
 count = 1000
 start = clock()
 for n in range(count):
-    response = HTTPResponse(devnull)
+    response = HTTPResponse(resp_p, devnull)
     environ = {
         'SERVER_NAME': 'test',
         'PATH_INFO': sys.argv[1]
         }
-    request = HTTPRequest(sys.stdin, environ, response)
-    publish(publication, request)
+    request = HTTPRequest(req_p, sys.stdin, environ, response)
+    publish(request)
 end = clock()
 print '%d requests/sec' % (count / (end - start))