[Zope] Changing class of objects in the ZODB

Miles Waller miles at jamkit.com
Mon Jun 12 11:58:21 EDT 2006


Hi,

Does anyone have a good approach to changing the class of an object 
already stored in the ZODB?

A site is using classes defined and customised in a product on the 
filesystem, and I want to split the product into two to separate the 
unmodified vanilla product, and customisations.  I found a script from 
shane when I googled which purported to do this, but I did not 
understand exactly what it did and so am a bit nervous of using it.  
Also, it appeared to do it all in one transaction, which would not be 
practical for this site (too many objects).

I had originally been envisaging doing something in __getstate__ for 
these objects, so when they were retrieved, they were updated and marked 
as having been changed so they would be committed at the end of the 
transaction.  But I don't really know exactly what!

I don't think it will work to use module_aliases because there will 
still be a class that can be imported from the original location.

Any help much appreciated,

Miles




More information about the Zope mailing list