Assuming you're not changing attribute values, but *just* the class, I've
had success with doing an XML export, a find/replace of the class name, and
a re-import.

The XML is fairly readable, you can just look for example for
"Products.MyProduct.OldClass" and replace it with


-----Original Message-----
Miles Waller
Sent: June 12, 2006 11:58 AM
Subject: [Zope] Changing class of objects in the ZODB


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,


Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to