[Zope] ZClass inheritancs:propertysheets

Dieter Maurer dieter@handshake.de
Sat, 7 Dec 2002 21:00:10 +0100


Patrick Stinson writes:
 > sorry for asking something this specific, but hidden attributes? I'm not
 > trying to do anythin special here, it's simple inheritance. A super class
 > has an attribute, I want to access it via one of its subclasses. Could you
 > find it in your hear to give me a quick code example?
When the derived class redefines an attribute ("site_url" in your case)
of the inherited class, this definition hides the inherited one.

But maybe, that is not your problem.

When you want to access an (unhidden) attribute of the inherited
class, you do it in the same way as for the own attributes:

       classInstance.attribute

By the way, Zope implements properties as attributes. Thus,
normal attriute access gives you (read only) access to properties.

When you want to change a property, you must use either
the PropertyManager (for standard properties, such as "title") or 
the PropertySheet (for properties in a property sheet) API.

This is either:

     classInstance.manage_change/editProperties(...) (PropertyManager API)

or

     classInstance.propertysheets.sheetName.manage_change/editProperties(...)
					             (PropertySheet API)


Note that you cannot (easily) change inherited properties when
the property sheet (the property is defined in) has the same
name in the inherited and derived classes (avoid identical names!).


Dieter


PS: Please stay on the list.