[Zope3-checkins] SVN: Zope3/trunk/src/zope/publisher/ Merged from 3.2 branch:

Jim Fulton jim at zope.com
Sat Dec 24 11:49:13 EST 2005


Log message for revision 41027:
  Merged from 3.2 branch:
  
  ------------------------------------------------------------------------
    r40925 | jim | 2005-12-20 17:40:05 -0500 (Tue, 20 Dec 2005) | 3 lines
  
  Added a write method that fails with a, hopefully, helpful
    exception.
  

Changed:
  U   Zope3/trunk/src/zope/publisher/http.py
  U   Zope3/trunk/src/zope/publisher/tests/test_http.py

-=-
Modified: Zope3/trunk/src/zope/publisher/http.py
===================================================================
--- Zope3/trunk/src/zope/publisher/http.py	2005-12-24 16:48:29 UTC (rev 41026)
+++ Zope3/trunk/src/zope/publisher/http.py	2005-12-24 16:49:13 UTC (rev 41027)
@@ -593,7 +593,6 @@
         d.update(self._cookies)
         return d.keys()
 
-
 class HTTPResponse(BaseResponse):
     implements(IHTTPResponse, IHTTPApplicationResponse)
 
@@ -922,6 +921,12 @@
                 c[name][k] = str(v)
         return str(c).splitlines()
 
+    def write(*_):
+        raise TypeError(
+            "The HTTP response write method is no longer supported. "
+            "See the file httpresults.txt in the zope.publisher package "
+            "for more information."
+            )
 
 def sort_charsets(x, y):
     if y[1] == 'utf-8':

Modified: Zope3/trunk/src/zope/publisher/tests/test_http.py
===================================================================
--- Zope3/trunk/src/zope/publisher/tests/test_http.py	2005-12-24 16:48:29 UTC (rev 41026)
+++ Zope3/trunk/src/zope/publisher/tests/test_http.py	2005-12-24 16:49:13 UTC (rev 41027)
@@ -460,6 +460,11 @@
         # the request should have converted PATH_INFO to unicode
         self.assertEqual(req['PATH_INFO'], u'/äö/üß/foo/bar.html')
 
+    def testResponseWriteFaile(self):
+        self.assertRaises(TypeError,
+                          self._createRequest().response.write,
+                          'some output',
+                          )
 
 class ConcreteHTTPTests(HTTPTests):
     """Tests that we don't have to worry about subclasses inheriting and



More information about the Zope3-Checkins mailing list