[Zope] Adding another base class to an existing ZClass

Gregor vorlon@iglou.com
Sun, 9 Jan 2000 22:51:49 -0500


----- 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