[Zope] How to access the attributes of a base class?

Lars Heber Lars.Heber@t-systems.com
Mon, 08 Apr 2002 09:16:29 +0200


Dieter Maurer wrote:

> Lars Heber writes:
>  > I have a ZClass Folder and a ZClass SpecialFolder, which has Folder as
>  > base class.
>  > Within an instance of SpecialFolder, I need access to a property
>  > declared in the base class Folder.
> Not sure, I understand your problem...
>
>   It is trivial to access a property defined in a base class
>   (provided it is not overwritten in the derived class):
>
>         instance.property_defined_in_base_class
>
> But, I must miss something as it is too simple...
>
> Dieter

Sorry, I forgot to mention that I want to CHANGE that property in the base
class,
i. e. apply manage_change to the property. I try to explain my problem again:

Actually, I want users to change a property prop_in_base_class.
I noticed that in the subclass SpecialFolder, I cannot create a view that
shows the corresponding property sheet of the base class. So, as an
alternative, I wanted to change this property via dtml.
I still tried:

<dtml-call
"mySpecialFolderInstance.propertysheets.attributes.manage_changeProperties({'property_in_base_class':'new_value'})">

When I do this with properties of the sub class, everything works fine. But
the above doesn't work. No error, just the unchanged value remains.

Both the base class and the sub class have a property sheet with the same
name.

I just tried to create a new property sheet in the base class and create for
it a view in the base class.
But wait - hooray, I've got it!!!

Now, I created in the sub class a dummy method which just redirects to this
property sheet - and it works!!!

The only content of this dummy method is:
<dtml-call
"RESPONSE.redirect('propertysheets/newPropertySheetInBaseClass/manage')">

Created a view for this method in the sub class, and here we are!

So, thanks to you all!

I'll stay with this method if nobody can tell me a simpler way to do it.

--
Lars Heber, mailto:Lars.Heber@t-systems.com

T-Systems, debis Systemhaus GEI GmbH, Geschaeftsstelle Sachsen