[Zope] Properties in a propertysheets unreachable
Dieter Maurer
dieter@handshake.de
Fri, 15 Mar 2002 20:43:57 +0100
Peter Bengtsson writes:
> In a ZClass you can define a couple of propertysheets and stick properties
> in there that can be access from the instance like a "normal" property.
>
> # Explicit way
> print context.propertysheets.get('myproperties').getProperty('age')
>
> # ...or simpler:
> print context.age
>
>
> I'm developing a python product and now I can't reach my properties from my
> templates.
> I must use the explicity way to get to the values.
>
> # This works
> <div
> tal:replace="python:here.propertysheets.get('properties').getProperty('name_cookiekey')"></div>
>
> # This doesn't (which used to work when the product was a ZCLass)
> <div tal:replace="python:here.name_cookiekey"></div>
>
>
> What do I need to do to get simple access to the properties in the
> propertysheets I have?
I did not yet fully understand the magic of PropertySheets in
ZClasses. I think, we have 2 features:
* The ZClass somehow inherits from the PropertySheets class.
This way, class properties are made available to Z Instances.
Be careful, this is only a guess!
* The PropertySheet instances store their properties directly
in the containing object. Therefore, you can access them
as attributes.
That's quite sure.
Dieter