[Zope-CVS] CVS: Products/AdaptableStorage/zodb - RemainingState.py:1.5

Shane Hathaway shane@zope.com
Fri, 10 Jan 2003 14:56:24 -0500


Update of /cvs-repository/Products/AdaptableStorage/zodb
In directory cvs.zope.org:/tmp/cvs-serv17035/zodb

Modified Files:
	RemainingState.py 
Log Message:
Fixed compatibility with Python 2.1


=== Products/AdaptableStorage/zodb/RemainingState.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/zodb/RemainingState.py:1.4	Thu Jan  9 18:03:36 2003
+++ Products/AdaptableStorage/zodb/RemainingState.py	Fri Jan 10 14:56:21 2003
@@ -37,7 +37,11 @@
         return self.schema
 
     def canSerialize(self, object):
-        return isinstance(object, Persistent)
+        try:
+            return isinstance(object, Persistent)
+        except TypeError:
+            # XXX Python 2.1 thinks Persistent is not a class
+            return 0
 
 
     def serialize(self, object, event):
@@ -62,7 +66,7 @@
                           unmanaged=unmanaged):
             ref = getInternalRef(ob)
             if ref is None:
-                if isinstance(ob, Persistent):
+                if hasattr(ob, '_p_oid'):
                     # Persistent objects that end up in the remainder
                     # are unmanaged.  Tell ZODB about them so that
                     # ZODB can deal with them specially.