[Zope] Adding another base class to an existing ZClass

Gregor vorlon@iglou.com
Mon, 10 Jan 2000 15:29:33 -0500


----- Original Message -----
From: "Kevin Dangoor" <kid@kendermedia.com>
To: "Chris McDonough" <chrism@digicool.com>; "Gregor" <vorlon@iglou.com>

> 3) Start copying and pasting your methods and such... rebuild your
> propertysheets. This is the tedious part.

Only the property sheets of the class you are changing really have to be
rebuilt, and this is only because Zope doesn't support cutting or copying
Property Sheets (why?).  It does support Exporting them, but as far as I can
tell, Importing them is not supported (which seems weird) or works
counter-intuitively.


So let's see if we can't formalize the process for a How-To (unless there's
one already up that I haven't seen):

Parent: The ZClass that you need to change base classes for.

ParentMetaType: The Meta Type of Parent, available on the "Basic" tab.

ParentID: The actual name/ID of Parent (as opposed to the literal word
"Parent").  Not to be confused with ParentClassID.

ParentClassID: The garbage in the "class id" field of Parent's "Basic" tab.
Looks something like "yf14F2CKDLkO79P4DnDeKw=="

0. Pack and Backup your database ;-)

1. Find and copy the current ParentClassID (using your computer's clipboard
function)

2. Append an = to ParentClassID.

3. Append "old" to ParentMetaType.

4. Go to the object containing Parent.  This will be your Product, if Parent
is the topmost ZClass.  We will call this object "Top".

5. Append _old to ParentID

6. Still in "Top", add a new ZClass.  Give it the original ParentID, the base
classes you need, and the original ParentMetaType.  Uncheck the "Create
Constructor Objects" box (these already exist; we never changed them).


Halfway there!  Henceforth, Parent will be referred to as OldParent, and the
class you just made in step 6 will be called NewParent.

7. Go into NewParent's basic tab.  Replace the current "class id" with the one
you copied in step 1.

8. Go to OldParent's methods tab.  Select everything, then hit cut.

9. Back to NewParent's methods tab.  Paste.

10. Go look at the Property sheet(s) of OldParent. Reproduce these in
NewParent.

11. Check the Views, Permissions, and Define Permissions tabs of OldParent,
and make sure these are the same in NewParent.  If applicable, do the same for
"Subobjects" and whatever else your class had.

12. Set the icon of NewParent.  You might need to fix the icons of any child
classes (not sure).


After you've made sure you've gotten everything out of it that you need,
delete OldParent and enjoy.

Well, I did that more or less as I wrote it, but I need a Zope Guru to look at
it and go "Uh, you forgot this major issue" or whatever. ;-)