Comment 0 for bug 143248

Revision history for this message
Brent Hendricks (brentmh-rice) wrote :

Uploaded: testCrossDBCopyPaste.py

I've observed that cut/paste fails across mounted databases when using ZODBMountPoint, raising an

InvalidObjectReference: Attempt to store an object from a foreign database connection

The attached unit test demonstrates this behavior. It tests both cut/paste (which succeeds) and copy/paste (which fails). If you place it in OFS/tests and then run 'test.py -v --dir lib/python/OFS' you should see the InvalidObjectReference error.

I believe the problem is that when pasting the object into a different ZODB, it notices that it has a _p_jar from the other ZODB and complains. My first thought was to just remove _p_jar, but that doesn't seem to be allowed, so I created a new copy of the object. I'll attach my suggested patch. It does allow my testcase to pass and doesn't seem to cause any other tests to fail, but I'm not 100% sure it's the best approach. This problem deals with persistence at a level somewhat beyond me :)