question about inheriting attributes
Hi, I am hoping to use ZClasses to setup a base class, with attributes which i would like to be available to ZClass instances of subclasses of that base class. But it doesn't seem that ZClass attributes are inheritable? Can i do this with python classes? Thanks, mark
Mark A. Lilly writes:
I am hoping to use ZClasses to setup a base class, with attributes which i would like to be available to ZClass instances of subclasses of that base class. But it doesn't seem that ZClass attributes are inheritable? They are, although you do not see it in the management interface of the derive ZClass.
The derived ZClass inherits both the property sheets and the properties from the base class. They are not listed in the derive class' PropertySheets tab but you can create views for them.
Can i do this with python classes? You can, but you need to be careful in defining "_properties" in the derived class.
Dieter
How do i create views for inherited properties? I tried creating a method which accessed an inherited attribute via <dtml-var>, but i got a Key Error on the attribute from the parent class. Any guidance is much welcome. Thanks, mark
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Dieter Maurer Sent: Wednesday, July 03, 2002 11:10 AM To: Mark A. Lilly Cc: zope@zope.org Subject: Re: [Zope] question about inheriting attributes
Mark A. Lilly writes:
I am hoping to use ZClasses to setup a base class, with attributes which i would like to be available to ZClass instances of subclasses of that base class. But it doesn't seem that ZClass attributes are inheritable? They are, although you do not see it in the management interface of the derive ZClass.
The derived ZClass inherits both the property sheets and the properties from the base class. They are not listed in the derive class' PropertySheets tab but you can create views for them.
Can i do this with python classes? You can, but you need to be careful in defining "_properties" in the derived class.
Dieter
_______________________________________________ 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 )
participants (3)
-
Dieter Maurer -
Mark A. Lilly -
zope