Commit 03e88384 authored by Shane Hathaway's avatar Shane Hathaway

Fixed the conflict error retry logic.

parent b56e1da0
...@@ -261,7 +261,15 @@ class ZServerHTTPResponse(HTTPResponse): ...@@ -261,7 +261,15 @@ class ZServerHTTPResponse(HTTPResponse):
self._tempstart=e self._tempstart=e
stdout.write(file_part_producer(t,self._templock,b,e), l) stdout.write(file_part_producer(t,self._templock,b,e), l)
_retried_response = None
def _finish(self): def _finish(self):
if self._retried_response:
try:
self._retried_response._finish()
finally:
self._retried_response = None
return
stdout=self.stdout stdout=self.stdout
t=self._tempfile t=self._tempfile
...@@ -275,6 +283,20 @@ class ZServerHTTPResponse(HTTPResponse): ...@@ -275,6 +283,20 @@ class ZServerHTTPResponse(HTTPResponse):
self.stdout=None # need to break cycle? self.stdout=None # need to break cycle?
self._request=None self._request=None
def retry(self):
"""Return a request 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.
response=self.__class__(stdout=self.stdout, stderr=self.stderr)
response._http_version=self._http_version
response._http_connection=self._http_connection
response._server_version=self._server_version
self._retried_response = response
return response
class ChannelPipe: class ChannelPipe:
"""Experimental pipe from ZPublisher to a ZServer Channel. """Experimental pipe from ZPublisher to a ZServer Channel.
...@@ -346,21 +368,6 @@ class ChannelPipe: ...@@ -346,21 +368,6 @@ class ChannelPipe:
self._close=1 self._close=1
self._request.reply_code=response.status self._request.reply_code=response.status
def retry(self):
"""Return a request 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.
response=self.__class__(stdout=self.stdout, stderr=self.stderr)
response._http_version=self._http_version
response._http_connection=self._http_connection
response._server_version=self._server_version
return response
def make_response(request, headers): def make_response(request, headers):
"Simple http response factory" "Simple http response factory"
......
...@@ -261,7 +261,15 @@ class ZServerHTTPResponse(HTTPResponse): ...@@ -261,7 +261,15 @@ class ZServerHTTPResponse(HTTPResponse):
self._tempstart=e self._tempstart=e
stdout.write(file_part_producer(t,self._templock,b,e), l) stdout.write(file_part_producer(t,self._templock,b,e), l)
_retried_response = None
def _finish(self): def _finish(self):
if self._retried_response:
try:
self._retried_response._finish()
finally:
self._retried_response = None
return
stdout=self.stdout stdout=self.stdout
t=self._tempfile t=self._tempfile
...@@ -275,6 +283,20 @@ class ZServerHTTPResponse(HTTPResponse): ...@@ -275,6 +283,20 @@ class ZServerHTTPResponse(HTTPResponse):
self.stdout=None # need to break cycle? self.stdout=None # need to break cycle?
self._request=None self._request=None
def retry(self):
"""Return a request 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.
response=self.__class__(stdout=self.stdout, stderr=self.stderr)
response._http_version=self._http_version
response._http_connection=self._http_connection
response._server_version=self._server_version
self._retried_response = response
return response
class ChannelPipe: class ChannelPipe:
"""Experimental pipe from ZPublisher to a ZServer Channel. """Experimental pipe from ZPublisher to a ZServer Channel.
...@@ -346,21 +368,6 @@ class ChannelPipe: ...@@ -346,21 +368,6 @@ class ChannelPipe:
self._close=1 self._close=1
self._request.reply_code=response.status self._request.reply_code=response.status
def retry(self):
"""Return a request 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.
response=self.__class__(stdout=self.stdout, stderr=self.stderr)
response._http_version=self._http_version
response._http_connection=self._http_connection
response._server_version=self._server_version
return response
def make_response(request, headers): def make_response(request, headers):
"Simple http response factory" "Simple http response factory"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment