On Nov 9, 2005, at 9:21 AM, Syver Enstad wrote:

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?
I think that if you do that and commit and pack the database, the
old module/class references will be purged.

If you do this, the sys.modules hacking only has to happen
in the update script.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to