Commit ed6c560b authored by Christian Heimes's avatar Christian Heimes

Replaced all commit(1) calls by savepoint() except of some ZODB unit tests

parent be1a0d80
...@@ -38,6 +38,8 @@ Zope Changes ...@@ -38,6 +38,8 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Replaced all transaction.commit(1) calls by transaction.savepoint()
- Collector #1832: UnIndex swallowed ConflictErrors. - Collector #1832: UnIndex swallowed ConflictErrors.
- Collector #1815: ZCTextIndex accepts (again) sequences of strings to - Collector #1815: ZCTextIndex accepts (again) sequences of strings to
......
...@@ -461,7 +461,7 @@ class CopySource(ExtensionClass.Base): ...@@ -461,7 +461,7 @@ class CopySource(ExtensionClass.Base):
# 1) Make sure the data about to be exported is current # 1) Make sure the data about to be exported is current
# 2) Ensure self._p_jar and container._p_jar are set even if # 2) Ensure self._p_jar and container._p_jar are set even if
# either one is a new object # either one is a new object
transaction.commit(1) transaction.savepoint()
if self._p_jar is None: if self._p_jar is None:
raise CopyError, ( raise CopyError, (
......
...@@ -516,7 +516,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -516,7 +516,7 @@ class File(Persistent, Implicit, PropertyManager,
# Make sure we have an _p_jar, even if we are a new object, by # Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit. # doing a sub-transaction commit.
transaction.commit(1) transaction.savepoint()
if self._p_jar is None: if self._p_jar is None:
# Ugh # Ugh
...@@ -542,7 +542,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -542,7 +542,7 @@ class File(Persistent, Implicit, PropertyManager,
data.next = next data.next = next
# Save the object so that we can release its memory. # Save the object so that we can release its memory.
transaction.commit(1) transaction.savepoint()
data._p_deactivate() data._p_deactivate()
# The object should be assigned an oid and be a ghost. # The object should be assigned an oid and be a ghost.
assert data._p_oid is not None assert data._p_oid is not None
......
...@@ -64,7 +64,7 @@ class EventTest(FiveTestCase): ...@@ -64,7 +64,7 @@ class EventTest(FiveTestCase):
manage_addSimpleContent(self.folder, 'foo', 'Foo') manage_addSimpleContent(self.folder, 'foo', 'Foo')
# somehow we need to at least commit a subtransaction to make # somehow we need to at least commit a subtransaction to make
# renaming succeed # renaming succeed
transaction.commit(1) transaction.savepoint()
self.folder.manage_renameObject('foo', 'bar') self.folder.manage_renameObject('foo', 'bar')
bar = self.folder.bar bar = self.folder.bar
events = objectEventCatcher.getEvents() events = objectEventCatcher.getEvents()
...@@ -98,7 +98,7 @@ class EventTest(FiveTestCase): ...@@ -98,7 +98,7 @@ class EventTest(FiveTestCase):
manage_addSimpleContent(folder1, 'foo', 'Foo') manage_addSimpleContent(folder1, 'foo', 'Foo')
foo = folder1.foo foo = folder1.foo
# need to trigger subtransaction before copy/paste can work # need to trigger subtransaction before copy/paste can work
transaction.commit(1) transaction.savepoint()
cb = folder1.manage_cutObjects(['foo']) cb = folder1.manage_cutObjects(['foo'])
folder2.manage_pasteObjects(cb) folder2.manage_pasteObjects(cb)
newfoo = folder2.foo newfoo = folder2.foo
...@@ -128,7 +128,7 @@ class EventTest(FiveTestCase): ...@@ -128,7 +128,7 @@ class EventTest(FiveTestCase):
manage_addNoVerifyPasteFolder(self.folder, 'folder1') manage_addNoVerifyPasteFolder(self.folder, 'folder1')
folder1 = self.folder.folder1 folder1 = self.folder.folder1
# need to trigger subtransaction before copy/paste can work # need to trigger subtransaction before copy/paste can work
transaction.commit(1) transaction.savepoint()
cb = self.folder.manage_copyObjects(['foo']) cb = self.folder.manage_copyObjects(['foo'])
folder1.manage_pasteObjects(cb) folder1.manage_pasteObjects(cb)
foo_copy = folder1.foo foo_copy = folder1.foo
......
...@@ -50,7 +50,7 @@ def _getDB(): ...@@ -50,7 +50,7 @@ def _getDB():
root = conn.root() root = conn.root()
app = Application() app = Application()
root['Application']= app root['Application']= app
transaction.commit(1) transaction.savepoint()
_populate(app) _populate(app)
stuff['db'] = db stuff['db'] = db
conn.close() conn.close()
...@@ -190,7 +190,9 @@ class TestSessionManager(TestBase): ...@@ -190,7 +190,9 @@ class TestSessionManager(TestBase):
sd.set('foo', 'bar') sd.set('foo', 'bar')
# TODO: transaction.commit() always returns None. Is that # TODO: transaction.commit() always returns None. Is that
# all this is trying to test? # all this is trying to test?
self.failUnless(transaction.commit(1) == None) #self.failUnless(transaction.savepoint() == None)
# XXX: with savepoints this test makes even less sense
transaction.savepoint()
def testForeignObject(self): def testForeignObject(self):
self.assertRaises(InvalidObjectReference, self._foreignAdd) self.assertRaises(InvalidObjectReference, self._foreignAdd)
......
...@@ -586,7 +586,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -586,7 +586,7 @@ class ZCatalog(Folder, Persistent, Implicit):
# we should commit a subtransaction if our threshhold is # we should commit a subtransaction if our threshhold is
# exceeded within the boundaries of the current transaction. # exceeded within the boundaries of the current transaction.
if self._v_total > self.threshold: if self._v_total > self.threshold:
transaction.commit(1) transaction.savepoint()
self._p_jar.cacheGC() self._p_jar.cacheGC()
self._v_total = 0 self._v_total = 0
if pghandler: if pghandler:
......
...@@ -54,7 +54,7 @@ class SimpleTrailblazer: ...@@ -54,7 +54,7 @@ class SimpleTrailblazer:
o = context.restrictedTraverse(id) o = context.restrictedTraverse(id)
# Commit a subtransaction to assign the new object to # Commit a subtransaction to assign the new object to
# the correct database. # the correct database.
transaction.commit(1) transaction.savepoint()
return o return o
def traverseOrConstruct(self, path, omit_final=0): def traverseOrConstruct(self, path, omit_final=0):
...@@ -107,7 +107,7 @@ class CustomTrailblazer (SimpleTrailblazer): ...@@ -107,7 +107,7 @@ class CustomTrailblazer (SimpleTrailblazer):
obj = context.unrestrictedTraverse(id) obj = context.unrestrictedTraverse(id)
# Commit a subtransaction to assign the new object to # Commit a subtransaction to assign the new object to
# the correct database. # the correct database.
transaction.commit(1) transaction.savepoint()
return obj return obj
...@@ -177,7 +177,7 @@ class MountedObject(MountPoint, SimpleItem): ...@@ -177,7 +177,7 @@ class MountedObject(MountPoint, SimpleItem):
obj = Application() obj = Application()
root[real_root] = obj root[real_root] = obj
# Get it into the database # Get it into the database
transaction.commit(1) transaction.savepoint()
else: else:
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment