[Zope-dev] Re: Patching object class
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Fri, 20 Jun 2003 17:18:43 +0200
Florent Guillaume wrote:
> I have the need to "update" some persistent objects in a ZODB to change
> their class.
>
> One use case comparable to the one I have would be to change all objects
> of type Folder to OrderedFolder.
> To do that, I envisionned finding all thoses objects and doing
>
> ob.__class__ = OrderedFolder
> ob._p_changed = 1
>
> Would this work ?
>
> If not, what other hack could I do ? The idea being that I don't want to
> recreate all the objects.
Maybe you should install OrderedObjectManager for bringing order to all
your folders.
http://www.zope.org/Members/mjablonski/OrderedObjectManager
I'll release an api-updated version when 2.7 is released.
Cheers, Maik