[Zope-Checkins] SVN: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/ Stop danceing status / errmsg into / out of the headers list.

Tres Seaver tseaver at palladion.com
Tue Dec 22 00:06:02 EST 2009


Log message for revision 106849:
  Stop danceing status / errmsg into / out of the headers list.

Changed:
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py
  U   Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py

-=-
Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py	2009-12-22 05:00:07 UTC (rev 106848)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/HTTPResponse.py	2009-12-22 05:06:02 UTC (rev 106849)
@@ -181,7 +181,6 @@
         if status == 200:
             self.status = 200
             self.errmsg = 'OK'
-            headers['status'] = "200 OK"
         else:
             self.setStatus(status)
 
@@ -232,7 +231,6 @@
             else:
                 reason = 'Unknown'
 
-        self.setHeader('Status', "%d %s" % (status,str(reason)))
         self.errmsg = reason
         # lock the status if we're told to
         if lock:
@@ -924,10 +922,8 @@
         append = chunks.append
 
         # status header must come first.
-        append("Status: %s" % headers.get('status', '200 OK')) # WTF
+        append("Status: %d %s" % (self.status, self.errmsg))
         append("X-Powered-By: Zope (www.zope.org), Python (www.python.org)")
-        if headers.has_key('status'): # WTF
-            del headers['status']
         for key, value in headers.items():
             if key.lower() == key:
                 # only change non-literal header names

Modified: Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py
===================================================================
--- Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py	2009-12-22 05:00:07 UTC (rev 106848)
+++ Zope/branches/tseaver-fix_wsgi/src/ZPublisher/tests/testHTTPResponse.py	2009-12-22 05:06:02 UTC (rev 106849)
@@ -27,7 +27,6 @@
     def test_ctor_defaults(self):
         import sys
         response = self._makeOne()
-        self.assertEqual(response.headers, {'status': '200 OK'}) # XXX WTF?
         self.assertEqual(response.accumulated_headers, [])
         self.assertEqual(response.status, 200)
         self.assertEqual(response.errmsg, 'OK')
@@ -44,30 +43,26 @@
     def test_ctor_w_headers(self):
         response = self._makeOne(headers={'foo': 'bar'})
         self.assertEqual(response.headers, {'foo': 'bar',
-                                            'status': '200 OK', # XXX WTF
                                            })
 
     def test_ctor_w_status_code(self):
         response = self._makeOne(status=401)
         self.assertEqual(response.status, 401)
         self.assertEqual(response.errmsg, 'Unauthorized')
-        self.assertEqual(response.headers,
-                         {'status': '401 Unauthorized'}) # XXX WTF?
+        self.assertEqual(response.headers, {})
 
     def test_ctor_w_status_errmsg(self):
         response = self._makeOne(status='Unauthorized')
         self.assertEqual(response.status, 401)
         self.assertEqual(response.errmsg, 'Unauthorized')
-        self.assertEqual(response.headers,
-                         {'status': '401 Unauthorized'}) # XXX WTF?
+        self.assertEqual(response.headers, {})
 
     def test_ctor_w_status_exception(self):
         from zExceptions import Unauthorized
         response = self._makeOne(status=Unauthorized)
         self.assertEqual(response.status, 401)
         self.assertEqual(response.errmsg, 'Unauthorized')
-        self.assertEqual(response.headers,
-                         {'status': '401 Unauthorized'}) # XXX WTF?
+        self.assertEqual(response.headers, {})
 
     def test_ctor_charset_no_content_type_header(self):
         response = self._makeOne(body='foo')



More information about the Zope-Checkins mailing list