[Checkins] SVN: zope.publisher/trunk/ 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:46:57 EDT 2008


Log message for revision 90358:
  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.
  
  Merged revision 90357 from 3.4 branch with
  
    svn merge -r 90356:90357 svn+ssh://svn.zope.org/repos/main/zope.publisher/branches/3.4 .
  
  

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

-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt	2008-08-26 18:45:10 UTC (rev 90357)
+++ zope.publisher/trunk/CHANGES.txt	2008-08-26 18:46:57 UTC (rev 90358)
@@ -12,8 +12,12 @@
   within getPreferredCharsets().
 
 * LP #98284: Pass the ``size`` argument to readline, as the version of
-  twisted used in zope.app.twisted supports it
+  twisted used in zope.app.twisted supports it.
 
+* Fix the LP #98284 fix: do not pass ``size`` argument of None that causes
+  cStringIO objects to barf with a TypeError.
+
+
 3.5.3 (2008-06-20)
 ------------------
 

Modified: zope.publisher/trunk/src/zope/publisher/http.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/http.py	2008-08-26 18:45:10 UTC (rev 90357)
+++ zope.publisher/trunk/src/zope/publisher/http.py	2008-08-26 18:46:57 UTC (rev 90358)
@@ -216,7 +216,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/trunk/src/zope/publisher/tests/test_http.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/tests/test_http.py	2008-08-26 18:45:10 UTC (rev 90357)
+++ zope.publisher/trunk/src/zope/publisher/tests/test_http.py	2008-08-26 18:46:57 UTC (rev 90358)
@@ -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