[Zope-CVS] CVS: Products/AdaptableStorage/zodb - ASConnection.py:1.21

Shane Hathaway shane@zope.com
Fri, 21 Feb 2003 12:16:50 -0500


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

Modified Files:
	ASConnection.py 
Log Message:
Fixed the error condition that happens when inter-database references are
accidentally introduced.  Until now, this led to "bad marshalling" errors.


=== Products/AdaptableStorage/zodb/ASConnection.py 1.20 => 1.21 ===
--- Products/AdaptableStorage/zodb/ASConnection.py:1.20	Fri Feb 21 11:08:10 2003
+++ Products/AdaptableStorage/zodb/ASConnection.py	Fri Feb 21 12:16:50 2003
@@ -415,11 +415,14 @@
         oid = self._db._oid_encoder.encode(keychain)
         return self._persistent_load(oid, hints)
 
-    def identifyObject(self, object):
-        oid = object._p_oid
+    def identifyObject(self, obj):
+        oid = obj._p_oid
         if oid is None:
             return None
-        assert oid != 'unmanaged', repr(object)
+        if obj._p_jar is not self:
+            raise InvalidObjectReference, (
+                "Can't refer to %s, located in %s, from %s"
+                % (repr(obj), repr(obj._p_jar), repr(self)))
         return self._db._oid_encoder.decode(oid)
 
     def newKey(self):