[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/file/file.py
Putative fix for Collector 1912.
Tim Peters
tim.one at comcast.net
Tue Oct 4 17:40:46 EDT 2005
Log message for revision 38759:
Putative fix for Collector 1912.
This a port from the Zope(2) trunk, where it applied
to OFS.Image.File. The Zope3 code in zope/app/file/file.py
appears to be a rewrite of that.
File._set_data(): This uses savepoints just to get oids assigned
and to free memory, with no possibility of rollback. Therefore
"optimistic" savepoints should be used: there's no reason here to
insist that any data managers involved support rollback.
If this should be ported to Zope3 branches, I'm not clear on
what they are, so someone else should do that.
Changed:
U Zope3/trunk/src/zope/app/file/file.py
-=-
Modified: Zope3/trunk/src/zope/app/file/file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/file.py 2005-10-04 21:23:28 UTC (rev 38758)
+++ Zope3/trunk/src/zope/app/file/file.py 2005-10-04 21:40:46 UTC (rev 38759)
@@ -115,7 +115,7 @@
>>> verifyClass(interfaces.IFile, File)
True
"""
-
+
implements(zope.app.publication.interfaces.IFileContent, interfaces.IFile)
def __init__(self, data='', contentType=''):
@@ -127,9 +127,9 @@
return str(self._data)
else:
return self._data
-
+
def _setData(self, data) :
-
+
# Handle case when data is a string
if isinstance(data, unicode):
data = data.encode('UTF-8')
@@ -165,7 +165,7 @@
# Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit.
- transaction.savepoint()
+ transaction.savepoint(optimistic=True)
jar = self._p_jar
@@ -197,7 +197,7 @@
data.next = next
# Now make it get saved in a sub-transaction!
- transaction.savepoint()
+ transaction.savepoint(optimistic=True)
# Now make it a ghost to free the memory. We
# don't need it anymore!
More information about the Zope3-Checkins
mailing list