[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ -
OFS.Image.manage_FTPget() would str() it's .data attribute,
Sidnei da Silva
sidnei at enfoldsystems.com
Wed Oct 12 17:33:53 EDT 2005
Log message for revision 39108:
- 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().
Changed:
U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
U Zope/branches/Zope-2_8-branch/lib/python/OFS/Image.py
-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-10-12 21:04:13 UTC (rev 39107)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-10-12 21:33:53 UTC (rev 39108)
@@ -22,7 +22,7 @@
- Collector #1233: port ZOPE_CONFIG patch from Zope 2.7 to Zope 2.8
- after Zope 2.8.1
+ after Zope 2.8.1
Features added
@@ -33,6 +33,11 @@
Bugs Fixed
+ - 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().
+
- When PageTemplates have a syntax error, show the traceback output
in the rendered error message.
@@ -44,7 +49,7 @@
character set used to encode unicode data that reaches
ZPublisher without any specified encoding.
- - disabled ".. include" directive for all the ZReST product and the
+ - disabled ".. include" directive for all the ZReST product and the
reStructuredText package
- Collector #1888: Adjust call to 'engine.translate' to accomodate
@@ -57,7 +62,7 @@
supporting 'debug' argument passed to
'ZPublisher.Test.publish_module'.
- - Collector #1879: applied patch by Dieter Maurer to fix a bug in
+ - Collector #1879: applied patch by Dieter Maurer to fix a bug in
ac_aquire() ignoring the default argument
- Collector #1864, #1906: fixed header normalization in appendHeader()
@@ -83,7 +88,7 @@
- Collector #1877: skel/Products/README.txt inappropriately copied
from CMF.
- - Collector #1871: Applied patch to support lists with records using
+ - Collector #1871: Applied patch to support lists with records using
ZTUtils.make_query()
- AccessControl: creating a new user through "zpasswd inituser" did not
@@ -99,11 +104,11 @@
- DateIndex now properly removes documents from both indexes if
the value is None
- - Collector #1888: Some parts of the TALInterpreter would not pass a
- default when translating, yet expect a string back. This would cause
- an error (usually "NoneType has no attribute 'replace'") in the case
+ - Collector #1888: Some parts of the TALInterpreter would not pass a
+ default when translating, yet expect a string back. This would cause
+ an error (usually "NoneType has no attribute 'replace'") in the case
the message was not translated.
-
+
Zope 2.8.1 (2005/08/11)
Features added
@@ -158,11 +163,11 @@
in Products/BTreeFolder2 (CMFCore will include it after 1.5, with
an appropriate module alias for backward compatibility).
- - Replaced all transaction.commit(1) calls by transaction.savepoint()
+ - Replaced all transaction.commit(1) calls by transaction.savepoint()
- Collector #1832: UnIndex swallowed ConflictErrors.
- - Collector #1815: ZCTextIndex accepts (again) sequences of strings to
+ - Collector #1815: ZCTextIndex accepts (again) sequences of strings to
be indexed.
- Collector #1812: Fixed key error in ZSQL ZMI/Test
@@ -179,7 +184,7 @@
- Collector #1808: manage_convertIndexes no longer tries to change the
index types causing some trouble with CMF.
- - manage_convertIndexes did not treat DateRangeIndexes and PathIndexes
+ - manage_convertIndexes did not treat DateRangeIndexes and PathIndexes
properly.
- Updated Zope X3 to bugfix release 3.0.1
@@ -200,7 +205,7 @@
- Collector #1803: Fixed InitializeClass for some corner case.
- - Collector #1798, issue 1: ZopeTestCase no longer tries to
+ - Collector #1798, issue 1: ZopeTestCase no longer tries to
install products that were installed by Zope during startup.
- Collector #1799: Avoid lying about parent's refcount when
Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/Image.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/OFS/Image.py 2005-10-12 21:04:13 UTC (rev 39107)
+++ Zope/branches/Zope-2_8-branch/lib/python/OFS/Image.py 2005-10-12 21:33:53 UTC (rev 39108)
@@ -594,6 +594,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:
@@ -602,11 +604,20 @@
# 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')
def manage_addImage(self, id, file, title='', precondition='', content_type='',
More information about the Zope-Checkins
mailing list