Jeremy Hylton <jeremy@zope.com> writes:
On Wed, 2004-03-31 at 09:19, Syver Enstad wrote:
I am looking for good resources on schema migration with ZODB.
http://www-106.ibm.com/developerworks/linux/library/l-pypers.html
Shows some of the techniques (the article is about Pickling) The article describes how to rename a class by changing the self.__class__ to the renamed class in __setstate__ but this doesn't seem to work.
(I haven't followed the link yet, but ...) You can't change the class of a persistent object, although it may seem like you can because you can assign to __class__.
I am not really interested in changing the class. I am interested in renaming it. Are there any resources on schema evolution/migration with ZODB, I have googled quite a bit but so far haven't come up with anything other than the link above which only seems to work with pickles.
The problem is that persistent references contain the class and oid of the object. So you can change __class__, but the next time the object is loaded it will get whatever class its referrer thinks it has.