[Zope] ZClasses, inheritance & other stuff.

Alexander Limi alexander@limi.net
Thu, 9 Dec 1999 03:48:42 +0100


Zopistas,

After fooling around a bit (a rather big bit, I might add (possibly even a
byte)), I have come across something not mentioned in the docs. (Surprise!)

My starting point is this:

I want to create a superclass, which has the properties inherited by all
the subclasses, like this:

Software
   |
   |--Application
   |
   |--Game

All software has properties that can (and should) be superclassed, like
software_title, software_publisher etc.

I tried to create ZClasses within ZClasses, but when I instantiate an
object of the type Game, I can only edit the variables set specifically in
Game, not the properties that should be inherited from Software.

I want to superclass as many variables as possible, to avoid duplication of
work. Most of the subclasses have 2 or 3 unique variables, all others are
common.

I am familiar with common OO parlance, but Zope is weird in some ways. I
suppose the properties are inherited in the above example, but I want to be
able to override the values from Software with instance
variables/properties/whatever. And to edit them (the inherited properties)
from the built-in zope manage form.

How do I do this?

Additionally, is there a way to automagically generate an addForm method
AFTER editing the propertysheet for that class, to reflect the new
variables (I'm getting tired of updating the HTML by hand every time :)

Regards,

Alexander.