[Zope] ZClasses, inheritance & other stuff.
Alexander Limi
alexander@mp3.no
Thu, 9 Dec 1999 16:15:13 +0100
> I hacked up the python code that makes up the ZDiscussions base
> classes. This
> allows me to make base classes that can inherit all kinds of
> nifty things from
> each other, but then I just have my ZClasses inherit from these
> classes. You
> still wont see your ZClasses in the selection lists, but at list
> your 'base'
> classes will be there. It is all rather complicated and
> unsatisfactory, but it
> does the job until zope has some more time to mature.
But I assumed that this is such a critical part of OO-design methodology
that I really should be possible in Zope. Would anyone in Digital Creations
care to step forward and explain why there is no easy way to do this?
And understand that this isn't meant as harsh as it sound, I am just
wondering why I can't implement very simple OO concepts in Zope. I guess
it's all a function of me being frustrated over the documentation. :)
My original post is included below.
Regards,
Alexander Limi
http://mp3.no
> Alexander Limi wrote:
>
> > 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 :)