[Checkins] SVN: zope.publisher/branches/3.4/ Fix the LP #98284 fix made in rev 89888: do not pass ``size`` argument of None

Marius Gedminas marius at pov.lt
Tue Aug 26 14:45:10 EDT 2008


Log message for revision 90357:
  Fix the LP #98284 fix made in rev 89888: do not pass ``size`` argument of None
  that causes cStringIO objects to barf with a TypeError.
  
  

Changed:
  U   zope.publisher/branches/3.4/CHANGES.txt
  U   zope.publisher/branches/3.4/src/zope/publisher/http.py
  U   zope.publisher/branches/3.4/src/zope/publisher/tests/test_http.py

-=-
Modified: zope.publisher/branches/3.4/CHANGES.txt
===================================================================
--- zope.publisher/branches/3.4/CHANGES.txt	2008-08-26 17:05:42 UTC (rev 90356)
+++ zope.publisher/branches/3.4/CHANGES.txt	2008-08-26 18:45:10 UTC (rev 90357)
@@ -4,7 +4,8 @@
 3.4.5 (unreleased)
 ------------------
 
-- ...
+* Fix the LP #98284 fix: do not pass ``size`` argument of None that causes
+  cStringIO objects to barf with a TypeError.
 
 3.4.4 (2008-08-18)
 ------------------

Modified: zope.publisher/branches/3.4/src/zope/publisher/http.py
===================================================================
--- zope.publisher/branches/3.4/src/zope/publisher/http.py	2008-08-26 17:05:42 UTC (rev 90356)
+++ zope.publisher/branches/3.4/src/zope/publisher/http.py	2008-08-26 18:45:10 UTC (rev 90357)
@@ -215,7 +215,12 @@
         # Previous versions of Twisted did not support the ``size`` argument
         # See http://twistedmatrix.com/trac/ticket/1451
         #     https://bugs.launchpad.net/zope3/+bug/98284
-        data = self.stream.readline(size)
+        # Note, however, that we cannot pass a size of None to cStringIO
+        # objects, or we'll get a TypeError: an integer is required
+        if size is not None:
+            data = self.stream.readline(size)
+        else:
+            data = self.stream.readline()
         self.cacheStream.write(data)
         return data
 

Modified: zope.publisher/branches/3.4/src/zope/publisher/tests/test_http.py
===================================================================
--- zope.publisher/branches/3.4/src/zope/publisher/tests/test_http.py	2008-08-26 17:05:42 UTC (rev 90356)
+++ zope.publisher/branches/3.4/src/zope/publisher/tests/test_http.py	2008-08-26 18:45:10 UTC (rev 90357)
@@ -19,7 +19,7 @@
 import sys
 import tempfile
 import unittest
-from StringIO import StringIO
+from cStringIO import StringIO
 from Cookie import CookieError
 
 import zope.event



More information about the Checkins mailing list