Functional testing framework HTTPCaller fails when request is retried because of Retry exception
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I found that in zope/app/
there is a class HTTPCaller with __call__ method like:
class HTTPCaller(
"""Execute an HTTP request string via the publisher"""
def __call__(self, request_string, handle_errors=True, form=None):
(...)
response = ResponseWrapper(
)
# sync Python connection:
return response
I was dealing with Retry exception and I get
strange errors during test. I found it is because
__call__ method assumes that request and response
are same objects during whole function.
It is not true when Retry exception is raised by
published code because retry creates new request
and response objects.
I think above code should be changed to:
class HTTPCaller(
"""Execute an HTTP request string via the publisher"""
def __call__(self, request_string, handle_errors=True, form=None):
(...)
request = publish(request, handle_
response = ResponseWrapper(
)
# sync Python connection:
return response
I've asked about this bug on zope-dev list: http://
This bug causes that it is not possible to execute some tests, eg. these for another bug I've submitted:
https:/
Test attached to above bug report may be used as well to check bug in functional.py
Your fix looks weird. A diff would be more helpful. The only change I can see is that you don't call publish() anymore. That can't be right. Maybe I missed something. From your description I have the feeling that using `return request.response` could fix the problem.