Update of /cvs-repository/Packages/OFS In directory cvs.zope.org:/tmp/cvs-serv12347/lib/python/OFS
Modified Files: Tag: Zope-2_7-branch Image.py Log Message: - OFS.Image.manage_FTPget() would str() it's .data attribute, potentially loading the whole file in memory as a string. Changed to use RESPONSE.write() iterating through the Pdata chain, just like index_html(). === Packages/OFS/Image.py 1.145.2.12 => 1.145.2.13 === --- Packages/OFS/Image.py:1.145.2.12 Fri Jun 3 12:15:00 2005 +++ Packages/OFS/Image.py Wed Oct 12 17:27:06 2005 @@ -218,7 +218,7 @@ return True ranges = HTTPRangeSupport.expandRanges(ranges, self.size) - + if len(ranges) == 1: # Easy case, set extra header and return partial set. start, end = ranges[0] @@ -401,10 +401,10 @@ return result self.ZCacheable_set(None) - + data=self.data if type(data) is type(''): - RESPONSE.setBase(None) + RESPONSE.setBase(None) return data while data is not None: @@ -597,6 +597,8 @@ def manage_FTPget(self): """Return body for ftp.""" + RESPONSE = self.REQUEST.RESPONSE + if self.ZCacheable_isCachingEnabled(): result = self.ZCacheable_get(default=None) if result is not None: @@ -605,9 +607,19 @@ # from FileCacheManager. # the content-length is required here by HTTPResponse, even # though FTP doesn't use it. - self.REQUEST.RESPONSE.setHeader('Content-Length', self.size) + RESPONSE.setHeader('Content-Length', self.size) return result - return str(self.data) + + data = self.data + if type(data) is type(''): + RESPONSE.setBase(None) + return data + + while data is not None: + RESPONSE.write(data.data) + data = data.next + + return '' manage_addImageForm=DTMLFile('dtml/imageAdd',globals(), Kind='Image',kind='image') _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins