[Zope-Checkins] CVS: ZODB3/ZODB/tests - StorageTestBase.py:1.23

Barry Warsaw barry@wooz.org
Tue, 21 Jan 2003 16:54:31 -0500


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv16387

Modified Files:
	StorageTestBase.py 
Log Message:
zodb_pickle(): Give the Pickler a persistent_id function so that it
acts more like what happens when you commit new object revisions using
the higher level interface.


=== ZODB3/ZODB/tests/StorageTestBase.py 1.22 => 1.23 ===
--- ZODB3/ZODB/tests/StorageTestBase.py:1.22	Fri Dec  6 18:04:36 2002
+++ ZODB3/ZODB/tests/StorageTestBase.py	Tue Jan 21 16:54:29 2003
@@ -37,8 +37,12 @@
 
 def zodb_pickle(obj):
     """Create a pickle in the format expected by ZODB."""
+    def persistent_id(obj):
+        return getattr(obj, '_p_oid', None)
+
     f = StringIO()
     p = Pickler(f, 1)
+    p.persistent_id = persistent_id
     klass = obj.__class__
     assert not hasattr(obj, '__getinitargs__'), "not ready for constructors"
     args = None