[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/publisher/ Added a write method that fails with a, hopefully, helpful

Jim Fulton jim at zope.com
Tue Dec 20 17:40:06 EST 2005


Log message for revision 40925:
  Added a write method that fails with a, hopefully, helpful
  exception.
  

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

-=-
Modified: Zope3/branches/3.2/src/zope/publisher/http.py
===================================================================
--- Zope3/branches/3.2/src/zope/publisher/http.py	2005-12-20 22:39:59 UTC (rev 40924)
+++ Zope3/branches/3.2/src/zope/publisher/http.py	2005-12-20 22:40:05 UTC (rev 40925)
@@ -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/branches/3.2/src/zope/publisher/tests/test_http.py
===================================================================
--- Zope3/branches/3.2/src/zope/publisher/tests/test_http.py	2005-12-20 22:39:59 UTC (rev 40924)
+++ Zope3/branches/3.2/src/zope/publisher/tests/test_http.py	2005-12-20 22:40:05 UTC (rev 40925)
@@ -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