[Zope-Checkins] CVS: Packages/ZPublisher - Iterators.py:1.1.4.3

Jens Vagelpohl jens at dataflake.org
Mon Jan 10 08:44:15 EST 2005


Update of /cvs-repository/Packages/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv17899/lib/python/ZPublisher

Modified Files:
      Tag: Zope-2_7-branch
	Iterators.py 
Log Message:
- Fix blowups when attempting to cache DTML Methods using
  filestream_iterator-based caching


=== Packages/ZPublisher/Iterators.py 1.1.4.2 => 1.1.4.3 ===
--- Packages/ZPublisher/Iterators.py:1.1.4.2	Thu Apr  8 12:00:03 2004
+++ Packages/ZPublisher/Iterators.py	Mon Jan 10 08:44:15 2005
@@ -20,6 +20,13 @@
         StopIeration if we've reached the end of the bytestream.
         """
 
+    def __len__(self):
+        """
+        Return an integer representing the length of the object
+        in bytes.
+        """
+
+
 class filestream_iterator(file):
     """
     a file subclass which implements an iterator that returns a
@@ -37,5 +44,11 @@
         if not data:
             raise StopIteration
         return data
+
+    def __len__(self):
+        cur_pos = self.tell()
+        self.seek(0, 2)
+        size = self.tell()
+        self.seek(cur_pos, 0)
     
-    
+        return size



More information about the Zope-Checkins mailing list