[Zope] ZClass inheritancs:propertysheets

Patrick Stinson ajole-1@gci.net
Sun, 8 Dec 2002 03:45:18 -0000


yes, I noticed that property sheets with identical names in super and sub
classes is bad.

It does help to know that instance.property is read-only. re-implementing
attriubutes? I don't even think that's possible!

Thanks for the help with the PropertyManager/Sheet tip. I don't think I ever
would have found that elsewhere.

-P


-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Dieter Maurer
Sent: Saturday, December 07, 2002 8:00 PM
To: Patrick Stinson
Cc: zope@zope.org
Subject: RE: [Zope] ZClass inheritancs:propertysheets


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.

_______________________________________________
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 )