[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/tests - testPublisherServer.py:1.1.2.6

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 16:26:00 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Server/tests
In directory cvs.zope.org:/tmp/cvs-serv7731/Zope/Server/tests

Modified Files:
      Tag: Zope-3x-branch
	testPublisherServer.py 
Log Message:
Merged the publication refactoring branch into the main branch.

Also renamed:

  browser_reaverse -> publishTraverse

  browser_default -> browserDefault



=== Zope3/lib/python/Zope/Server/tests/testPublisherServer.py 1.1.2.5 => 1.1.2.6 ===
 from Zope.Server.TaskThreads import ThreadedTaskDispatcher
 from Zope.Server.PublisherServers import PublisherHTTPServer
-from Zope.Publisher.HTTP.BrowserPayload import BrowserRequestPayload
-from Zope.Publisher.HTTP.BrowserPayload import BrowserResponsePayload
+from Zope.Publisher.Browser.BrowserRequest import BrowserRequest
+
 from Zope.Publisher.DefaultPublication import DefaultPublication
 from Zope.Publisher.Exceptions import Redirect, Retry
 from Zope.Publisher.HTTP import HTTPRequest
@@ -59,18 +59,18 @@
     " "
     tries = 0
 
-    def __call__(self, URL):
-        return 'URL invoked: %s' % URL
+    def __call__(self, REQUEST):
+        return 'URL invoked: %s' % REQUEST.URL
 
-    def redirect_method(self, RESPONSE):
+    def redirect_method(self, REQUEST):
         "Generates a redirect using the redirect() method."
-        RESPONSE.redirect("http://somewhere.com/redirect")
+        REQUEST.getResponse().redirect("http://somewhere.com/redirect")
 
     def redirect_exception(self):
         "Generates a redirect using an exception."
         raise Redirect("http://somewhere.com/exception")
 
-    def conflict(self, URL, wait_tries):
+    def conflict(self, REQUEST, wait_tries):
         """
         Returns 202 status only after (wait_tries) tries.
         """
@@ -93,12 +93,15 @@
         obj._protected = tested_object()
 
         pub = PublicationWithConflict(obj)
-        request_payload = BrowserRequestPayload(pub)
-        response_payload = BrowserResponsePayload()
+
+        def request_factory(input_stream, output_steam, env):
+            request = BrowserRequest(input_stream, output_steam, env)
+            request.setPublication(pub)
+            return request
 
         td.setThreadCount(4)
         # Bind to any port on localhost.
-        self.server = PublisherHTTPServer(request_payload, response_payload, 
+        self.server = PublisherHTTPServer(request_factory,
                                           LOCALHOST, 0, task_dispatcher=td)
         self.port = self.server.socket.getsockname()[1]
         self.run_loop = 1