[Zodb-checkins] CVS: ZODB3/ZODB/tests - StorageTestBase.py:1.27.8.2

Jeremy Hylton jeremy at zope.com
Fri Jul 11 10:13:29 EDT 2003


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

Modified Files:
      Tag: zodb33-devel-branch
	StorageTestBase.py 
Log Message:
Write _persistent_id() helper function that ignores descriptors.


=== ZODB3/ZODB/tests/StorageTestBase.py 1.27.8.1 => 1.27.8.2 ===
--- ZODB3/ZODB/tests/StorageTestBase.py:1.27.8.1	Tue Jul  1 16:57:20 2003
+++ ZODB3/ZODB/tests/StorageTestBase.py	Fri Jul 11 09:13:22 2003
@@ -46,11 +46,18 @@
     while now == time.time():
         time.sleep(0.1)
 
+def _persistent_id(obj):
+    oid = getattr(obj, "_p_oid", None)
+    if getattr(oid, "__get__", None) is not None:
+        return None
+    else:
+        return oid
+
 def zodb_pickle(obj):
     """Create a pickle in the format expected by ZODB."""
     f = StringIO()
     p = Pickler(f, 1)
-    p.persistent_id = lambda obj: getattr(obj, '_p_oid', None)
+    p.persistent_id = _persistent_id
     klass = obj.__class__
     assert not hasattr(obj, '__getinitargs__'), "not ready for constructors"
     args = None




More information about the Zodb-checkins mailing list