[Zope] how add properties via Python script? /kv

Lennart Regebro lennart at regebro.nu
Wed Nov 5 10:16:52 EST 2003


Kai Vermehr wrote:
> I'm trying to add the property "product" to all the images inside the  
> "image_folder" with this line in Python:
> 
> container.image_folder.objectValues(['Image']).manage_addProperty(produc 
> t, name, string)
> 
> but it does not work ... why? How should it be done?

What you are doing above is that you try to add a propery to the list of 
images. What you want to do is to add a property to each image.

for image in container.image_folder.objectValues(['Image']):
     image.manage_addProperty(product, name, string)

Have you done the Python tutorial?




More information about the Zope mailing list