[ZODB-Dev] Migrating classes in ZODB 3.5.1

Dieter Maurer dieter at handshake.de
Wed Nov 9 15:03:47 EST 2005


David Binger wrote at 2005-11-9 10:11 -0500:
> ...
>>>> What I want to do is just update the persistent instance so that  
>>>> it will
>>>> load from the new module/ new class after I have done a one time  
>>>> update
>>>> of the database.
>>>>
>>>
>>> I fear this will not work.
>>>
>>> For efficiency reasons, the class designator (usually a
>>> module, classname tuple) is stored both in the object itself
>>> and in persistent references. While you will be able
>>> to modify the object's class the persistent references will
>>> only change when the containers are stored into the ZODB.
>
>Is there something to prevent your update script from
>setting _p_changed = 1 on every persistent object that contains
>a reference to an instance of the moved class?

You can do this in an update script but not in
"classFactory". "classFactory" does not know anything about
the origin of the reference or even the object.
It only knows connection, modulename and globalname.

-- 
Dieter


More information about the ZODB-Dev mailing list