[ZODB-Dev] Migrating classes in ZODB 3.5.1

Tim Peters tim at zope.com
Tue Nov 8 10:26:00 EST 2005


[Syver Enstad]
> 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.
>
> The ZODB.broken module has a rebuild function that might be the answer
> but I didn't understand how to use it to help me.
>
> If anybody on the list knows of any documentation regarding these issues
> please refer me to that.

I'm not familiar with "broken objects" in newer ZODBs, and didn't find any
docs apart from the docstrings in broken.py.  Brief overviews of new
features often appear in NEWS.txt, but the news for ZODB 3.3a3 just says
"New broken object support.", so no luck there either.

I don't have time now to try to figure it out, so I hope someone else can
help.  From the docstrings, it looks like the intent may be that you repair
a broken object by poking old->new maps into sys.modules, effectively using
that dict as your lookup table.  But I haven't used them, and I'm not sure.
Sorry!



More information about the ZODB-Dev mailing list