[Zope] Change the class of a Zope object

Max M maxm at mxm.dk
Thu May 13 03:30:29 EDT 2004


I have a bunch of objects in the ZODB that I need to convert to other 
objects.

The new object have the same meta_type and the same attributes. But they 
are of a new class.

So I thought that I could simply assign a new class.

I tried assigning the new class to __class__ but that didn't work. Like::

     obj.__class__ = SomeNewClass

I suspect that is because I am assigning it to an aquisition wrapper. 
But I am not shure.

Would I need to do something like?

     base = obj.aq_base
     base.__class__ = SomeNewClass

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science




More information about the Zope mailing list