[Zope] Mass update of a ZClass property?
Oliver Bleutgen
Oliver Bleutgen <myzope@gmx.net>
Mon, 18 Jun 2001 20:12:08 +0200
> Hi,
> I've a ZClass that defines an object of type X. In a folder there are
> around 100 X objects. Now one of the properties of the ZClass is a
> selection, drawn from a property "Category" which is of the type lines.
> The
> values are
> ['Music','Software','Book']
> Now, there is a requirement that 'Software' needs to be changed to 'CD'.
> How
> do I change that in the 100 X objects, that have 'Software' category, in
> one shot?
> Calling manage_editProperties in a loop for 100 objects should work. But
> this method needs REQUEST to be passed through. If I just set a REQUEST
> for
> "Category" but that erases other properties of the object :-( So, I
> suppose
> I've to load all properties for each object into REQUEST, then change
> "Category" to CD if it is 'Software' and then call manage_editProperties.
> Well, I tried playing with property_sheets.myproperty.propertyItems , with
> not much luck.
try
manage_editProperties(Category=['Music','CD','Book'])
you can find that in the API-documentation in zope's
online help.
cheers,
oliver