This patch changes the original implementation of HTTPResponse' retry() function so that the response instance is reused instead of replaced with a new one (after a Retry exception was raised). This fixes a bug in zopedoctests' http() function (Testing/ZopeTestCase/zopedoctest/functional.py:113): the doctest code assumes that the HTTPResponse instance passed to publish_module() (line 177) is used to handle to complete request, so it can be used to get the status, headers etc later on (lines 183-186). Normally this is okay, but raising a Retry will create a new response instance, which will then hold that data (relevant for evaluating the doctest) while the original (passed in) instance is still empty. So to fix this (quickly) retry() now cleans up and returns itself... --- ZPublisher/HTTPResponse.py~ 2006-05-30 07:08:18.000000000 +0200 +++ ZPublisher/HTTPResponse.py 2006-09-12 19:51:52.000000000 +0200 @@ -182,19 +182,20 @@ def retry(self): """Return a response object to be used in a retry attempt """ # This implementation is a bit lame, because it assumes that # only stdout stderr were passed to the constructor. OTOH, I # think that that's all that is ever passed. - return self.__class__(stdout=self.stdout, stderr=self.stderr) + self.__init__(stdout=self.stdout, stderr=self.stderr) + return self _shutdown_flag = None def _requestShutdown(self, exitCode=0): """Request that the server shut down with exitCode after fulfilling the current request.""" import ZServer ZServer.exit_code = exitCode self._shutdown_flag = 1