Commit defa21b4 authored by Jim Fulton's avatar Jim Fulton

Get commit from transaction.

parent a3b87052
...@@ -19,6 +19,7 @@ $Id$ ...@@ -19,6 +19,7 @@ $Id$
__docformat__ = "reStructuredText" __docformat__ = "reStructuredText"
from persistent import Persistent from persistent import Persistent
import transaction
WeakRefMarker = object() WeakRefMarker = object()
...@@ -60,7 +61,7 @@ class WeakRef(object): ...@@ -60,7 +61,7 @@ class WeakRef(object):
>>> conn1 = db.open() >>> conn1 = db.open()
>>> conn1.root()['ob'] = ob >>> conn1.root()['ob'] = ob
>>> conn1.root()['ref'] = ref >>> conn1.root()['ref'] = ref
>>> ZODB.tests.util.commit() >>> transaction.commit()
If we open a new connection, we can use the reference: If we open a new connection, we can use the reference:
...@@ -73,7 +74,7 @@ class WeakRef(object): ...@@ -73,7 +74,7 @@ class WeakRef(object):
But if we delete the referenced object and pack: But if we delete the referenced object and pack:
>>> del conn2.root()['ob'] >>> del conn2.root()['ob']
>>> ZODB.tests.util.commit() >>> transaction.commit()
>>> ZODB.tests.util.pack(db) >>> ZODB.tests.util.pack(db)
And then look in a new connection: And then look in a new connection:
...@@ -180,7 +181,7 @@ class PersistentWeakKeyDictionary(Persistent): ...@@ -180,7 +181,7 @@ class PersistentWeakKeyDictionary(Persistent):
>>> conn1.root()['d'] = d >>> conn1.root()['d'] = d
>>> conn1.root()['p2'] = p2 >>> conn1.root()['p2'] = p2
>>> conn1.root()['p3'] = p3 >>> conn1.root()['p3'] = p3
>>> ZODB.tests.util.commit() >>> transaction.commit()
And things still work, as before: And things still work, as before:
...@@ -210,7 +211,7 @@ class PersistentWeakKeyDictionary(Persistent): ...@@ -210,7 +211,7 @@ class PersistentWeakKeyDictionary(Persistent):
from the dictionary: from the dictionary:
>>> del conn2.root()['p2'] >>> del conn2.root()['p2']
>>> ZODB.tests.util.commit() >>> transaction.commit()
And pack the database, so that the no-longer referenced p2 is And pack the database, so that the no-longer referenced p2 is
actually removed from the database. actually removed from the database.
......
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