Sniff, was Re: [ZODB-Dev] Copying instances between multiple storages

Toby Dickenson tdickenson@geminidataloggers.com
Tue, 21 May 2002 11:02:03 +0100


On Mon, 20 May 2002 18:50:36 -0300, Christian Reis <kiko@async.com.br>
wrote:

>> Fair enough. So what do I have to do? Instance another object and copy
>> it's data over (ugh)?

Thats what I would do, if your object is of small finite size.

>> copy.copy/deepcopy won't help, will they?

I dont see why not. Have you tried it? Of course you can always define
your own __copy__ and __deepcopy__ methods, and this solution has all
the 'advantages' of your first solution.

>> Is there
>> anything in the ZODB that will clone an object for me?

Zope's management interface has a copy/paste facility, which uses
ZODB's import/export feature. Beware that you may end up 'cloning' the
whole database if your object has a reference to the root.

> have an idea how things would work,
>enough to give a simple "looks good/bad" answer?

A different solution would be to use application-specific handles to
the objects in the foreign database. Zope's ZCatalog uses urls for
this.

Toby Dickenson
tdickenson@geminidataloggers.com