[ZODB-Dev] Copying instances between multiple storages
Christian Reis
kiko@async.com.br
Tue, 7 May 2002 10:59:52 -0300
Hey there.
My application has now come to the phase where it has to operate sharing
objects between different sites, connected non-permanently. I've
envisioned a solution where I do all the consistency work in the
application level itself, and keep catalogs of updated products that
should sync with other places. (There could be other solutions, so if
you think of a good one, let me know). This would use none of ZODB's
transaction copy mechanism, since as far as I can tell it won't help
much when I only want to copy some specific objects.
My question is this: when I use two storages, and I retrieve an instance
from storage A, I can't just add a reference to it in storage B and
commit() - I get a very reasonable error:
ZODB.POSException.InvalidObjectReference: Attempt to store an object
from a foreign database connection
Fair enough. So what do I have to do? Instance another object and copy
it's data over (ugh)? copy.copy/deepcopy won't help, will they? Is there
anything in the ZODB that will clone an object for me?
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL