David Binger wrote:

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.

That was exactly what I was doing but I can't get it to work in 3.5.1. It works in 3.2 though. I don't want to upgrade online. I just want to take the system down. Run a one time upgrade script. Start the system in a new version with the moved/renamed modules/classes and not have to have all kinds of funky translations and dummy modules in my source code.

For more information about ZODB, see the ZODB Wiki:

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

Reply via email to