[Zope] changing object properties

Casey Duncan cduncan@kaivo.com
Tue, 13 Mar 2001 13:16:55 -0700


Ruberl Michele wrote:
> 
> Hi all,
> I created my first ZClass: ok
> Now I'd like to create a method for editing my class instances' properties,
> just for not using propertysheets/MyProperties/manage which is not the
> nicest to see.
> Ok, I created a DTML method with the front-end which calls a Script (Python)
> which should actually update the properties' values.
> I tried two ways of writing such a script:
> 
> 1.
> context._updateProperty(name_property, value_from_form)
> 
> It gives me an "IOError" while saving script changes (I suppose because it
> is an internal python method, it would works only if external, am I right?)
> 
> 2.
> context.name_property=value_from_form
> 
> It gives me an "Error Type: TypeError - Error Value: attribute-less object
> (assign or del)" when executed
> Now, probably it is a stupid Python question.. could you help me anyway?
> (I'd prefer to stay with just internal ppython methods)
> 
> Thanks a lot
> 
> Michele
> 

The following show do it:

context.propertysheets.MyProperties.manage_changeProperties(name_property=value)

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>