[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - BrowserRequest.py:1.1.4.9.2.1 BrowserResponse.py:1.1.4.3.2.1

Shane Hathaway shane@cvs.zope.org
Thu, 11 Apr 2002 12:34:45 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv13902/Browser

Modified Files:
      Tag: Zope3-Server-Branch
	BrowserRequest.py BrowserResponse.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/Browser/BrowserRequest.py 1.1.4.9 => 1.1.4.9.2.1 ===
     
 
-    def __init__(self, body_instream, outstream, environ):
+    def __init__(self, body_instream, outstream, environ, response=None):
         self._form = {}
-        super(BrowserRequest, self).__init__(body_instream, outstream, environ)
+        super(BrowserRequest, self).__init__(
+            body_instream, outstream, environ, response)
 
 
     def _createResponse(self, outstream):


=== Zope3/lib/python/Zope/Publisher/Browser/BrowserResponse.py 1.1.4.3 => 1.1.4.3.2.1 ===
         
         Sets the return body equal to the (string) argument "body". Also
-        updates the "content-length" return header.
-
-        If the body is a 2-element tuple, then it will be treated
-        as (title,body)
-        
-        If is_error is true then the HTML will be formatted as a Zope error
-        message instead of a generic HTML page.
+        updates the "content-length" return header and sets the status to
+        200 if it has not already been set.
         """
         body = str(body)
 
@@ -65,6 +60,8 @@
         body = self.__insertBase(body)
         self._body = body
         self._updateContentLength()
+        if not self._status_set:
+            self.setStatus(200)
 
     def __isHTML(self, str):
         s = str.strip().lower()
@@ -85,7 +82,7 @@
     def __insertBase(self, body):
         # Only insert a base tag if content appears to be html.
         content_type = self.getHeader('content-type', '')
-        if content_type and content_type != 'text/html':
+        if content_type and not is_text_html(content_type):
             return body
 
         if getattr(self, '_base', ''):