[Zope] Get properties from Python code
Dieter Maurer
dieter@handshake.de
Thu, 18 Jul 2002 19:56:16 +0200
Jim Kutter writes:
> I have a python script that I'd like to get a property from a page template.
>
> What would the code look like to do that?
>
> I've tried context['page.html'].properties['redirect'], context['page.html'].properties.getProperty('redirect'), and can't find anything in the docs that indicate how to do something like that...
Currently all Zope objects map their properties as attributes
of the object itself. This means, you access property "p" of object "o"
by "o.p".
When you want to change properties, it depends whether or not
they belong to a Property Sheet. This usually is the case for
ZClasses. For ZClasses, you can change them through:
o.propertysheets.your_property_sheet.manage_changeProperties(...)
When the properties do not belong to a propertysheet, you simple use
o.manage_changeProperties(...)
Dieter