On Dec 4, 2008, at 8:46 AM, Miles wrote:
> Thanks for your help
>>> (from ZODB.serialize.py - line 350)
>>> if obj._p_jar._implicitlyAdding(oid):
>>> raise InvalidObjectReference(
>>> "A new object is reachable from multiple
>>> databases. "
>>> "Won't try to guess which one was correct!"
>>> Can anyone shed any light on what this error means?!
>> It means a new object is referenced from objects in multiple
>> and it doesn't know what database to assign it to.
> After some digging into the objects, I think I understand this. It's
> come up as follows:
> - I load object A from the old database
> - Object A has an attribute B, which is an object also in the old
> - I create a fresh copy of A, but leave the attribute B remained a
> reference to B in the old database
> - When I went to commit A, I got an error because A.B points to the
> old database still
> Is this right?
No. The error is about a *new* object that is refered to from both
>>> Given a persistent
>>> object, what is the correct way to get a completely fresh copy
>>> that is
>>> not tied to any database at all, so I can transfer these old objects
>>> the current database.
>> I would use the database export/import API to export it from one
>> database and import it to another. (There are issues with doing this
>> in Zope 3, but I assume you're using Zope 2.
> Sorry if I'm being thick - I thought the code below did indeed use the
> export/import API:
> container = app.new_folder
> Is this what you meant? If so, I'll do some more digging.
Oops, I didn't notice that you were already doing this. This is odd.
I'm at a loss.
- Does your application involve multiple databases, aside from the
you are copying data between?
- How complex is the object in question?
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org