[Zope] ZClass direct variable access

Phill Hugo phill@fortune-cookie.com
Mon, 19 Mar 2001 14:11:13 +0000


Is there a way to access property sheet variables from a zclass method
without knowing which property sheet it is contained within.

For example, Class A has two prop sheets, S1 and S2 and Var1 is in S2.

I can do container.propertysheets.get('S2').getProperty('Var1')

or (if I has subclassed ObjectManager)... container['Var1']

The latter form I prefer since it doesn't require knowledge of which
sheet I'm really using but it only works if the zclass is based on
ObjectManager. In other cases it raises an exception (AttributeError,
__getitem__)

Any ideas or should this be added to the collector (I've a feeling a
basic __getitem__ should be included in ZObject for this type of thing).

Phill