Syver Enstad wrote at 2005-11-7 11:51 +0100:
>In ZODB 3.2 I can replace the _classFactory method on DB and locate the
>renamed/moved class by other means (a lookup table that maps old module
>classname pairs to another class in another module). If I change
>attributes of the persistent instance it will be saved with the new
>class name instead of the old.
>I can't get this strategy to work under 3.5.1. It seems to work okay as
>long as I use the custom classFactory method (not _classFactory as in
>3.2) but 3.5.1 doesn't seem to update the modulename, classname when I
>save the instance.
>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.
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org