AFAIK, there is no approved way to add a base class to an existing ZClass. I've heard from other people at DC that it is possible, but it's a "hold on to your butts" experience. That said, I have no idea whether Gregor's method will work or not. Gregor wrote:
----- Original Message ----- From: "Steve Jibson" <stevej@parlant.com> To: <zope@zope.org> Sent: Friday, January 07, 2000 6:22 PM Subject: [Zope] Adding another base class to an existing ZClass
I've spent many hours working on a ZClass (with multiple sub-zclasses, etc.), and now I've decided that I should have inherited from Folder as well as ObjectManager when I created the ZClass. Is there a way to add a base class to the base class list of an existing ZClass, or do I need to start all over?
Did anyone ever reply to this, or are you still trying to figure it out?
I've seen something in the Zope how-tos or guides about the "class id" field on the "basic" tab of the ZClass, and swapping out one ZClass for another.
I THINK the basic idea is that you would copy or export everything you want to keep (such as child ZClasses and methods) to a safe place, copy the ZClass's class id to a file somewhere, then delete the ZClass.
Create a new one with the same id, deriving from whatever you need. Then replace the new class's id with the one you saved in the file. Finally, re-import or paste the things you needed to keep from the old class.
I have not tested the above and have no idea if it would work, so I really recommend backing your database up before you try it. If you do try it, let me know how it works out.
- Gregor
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org