[Zope3-checkins] SVN: Zope3/trunk/src/mechanize/_util.py work around mechanize/urllib2 bug

Benji York benji at zope.com
Tue Aug 8 17:07:27 EDT 2006


Log message for revision 69378:
  work around mechanize/urllib2 bug
  

Changed:
  U   Zope3/trunk/src/mechanize/_util.py

-=-
Modified: Zope3/trunk/src/mechanize/_util.py
===================================================================
--- Zope3/trunk/src/mechanize/_util.py	2006-08-08 16:33:57 UTC (rev 69377)
+++ Zope3/trunk/src/mechanize/_util.py	2006-08-08 21:07:27 UTC (rev 69378)
@@ -439,6 +439,10 @@
             return self.__cache.read(size)
 
         # no, so read sufficient data from wrapped file and cache it
+        if self.wrapped.read is None:
+            # XXX oops, wrapped file-like-object isn't valid, ignore it
+            return ''
+
         self.__cache.seek(0, 2)
         if size == -1:
             self.__cache.write(self.wrapped.read())



More information about the Zope3-Checkins mailing list