[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.1.2.26.2.1 BaseResponse.py:1.1.2.11.2.1 IPublisherResponse.py:1.1.2.5.2.1 Publish.py:1.1.2.16.2.2
Shane Hathaway
shane@cvs.zope.org
Thu, 11 Apr 2002 12:34:45 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv13902
Modified Files:
Tag: Zope3-Server-Branch
BaseRequest.py BaseResponse.py IPublisherResponse.py
Publish.py
Log Message:
- Fixed status code handling. For HTTP, default to a special 599, which
means nothing set the status code. Added an internalError() call, which
should tell the client that the server failed to handle an exception.
- Fixed the retry mechanism. Because the status code check was disabled
in testHTTPServer, no one knew that retry wasn't working at all.
(tsk, tsk!) Had to add another argument to request constructors.
=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.26 => 1.1.2.26.2.1 ===
environment = RequestDataProperty(RequestEnvironment)
- def __init__(self, body_instream, outstream, environ, positional=()):
+ def __init__(self, body_instream, outstream, environ, response=None,
+ positional=()):
self._traversal_stack = []
self._traversed_names = []
self._environ = environ
self._args = positional
- self._response = self._createResponse(outstream)
+ if response is None:
+ self._response = self._createResponse(outstream)
+ else:
+ self._response = response
self._body_instream = body_instream
self._held = ()
=== Zope3/lib/python/Zope/Publisher/BaseResponse.py 1.1.2.11 => 1.1.2.11.2.1 ===
exc_info[0], exc_info[1], exc_info[2], 100, self)
+ def internalError(self):
+ 'See Zope.Publisher.IPublisherResponse.IPublisherResponse'
+ pass
+
def retry(self):
'See Zope.Publisher.IPublisherResponse.IPublisherResponse'
return self.__class__(self.outstream)
=== Zope3/lib/python/Zope/Publisher/IPublisherResponse.py 1.1.2.5 => 1.1.2.5.2.1 ===
def setBody(result):
- """Set's the response result value.
+ """Sets the response result value.
"""
def handleException(exc_info):
- """Handle an otherwise unhandled exception.
+ """Handles an otherwise unhandled exception.
- The handling of the exception is expected to effect the reponse body.
+ The publication object gets the first chance to handle an exception,
+ and if it doesn't have a good way to do it, it defers to the
+ response. Implementations should set the reponse body.
+ """
+
+ def internalError():
+ """Called when the exception handler bombs.
+
+ Should report back to the client that an internal error occurred.
"""
- # XXX ZopePublication seems to call this, so maybe this should be
- # in an IPublicationResponse interface, but maybe this will change,
- # so we'll apply YAGNI for now.
def outputBody():
- """Output the response to the client
+ """Outputs the response to the client
"""
def retry():
- """Return a retry response
+ """Returns a retry response
- Return a response suitable for repeating the publication attempt.
+ Returns a response suitable for repeating the publication attempt.
"""
=== Zope3/lib/python/Zope/Publisher/Publish.py 1.1.2.16.2.1 => 1.1.2.16.2.2 ===
# Bad exception handler or retry method.
# Re-raise after outputting the response.
+ request.getResponse().internalError()
to_raise = sys.exc_info()
break