[Zope] Add Property to Image with Form & Python?

Kevin Jones ktmi at earthlink.net
Sat Mar 27 02:16:20 EST 2004


Chris, All-

The problem was that I didn't explicitly define "id."  In the 
line where I add the image, I simply added:
 >>id=image_folder.manage_addImage blah blah blah...

It is interesting that when I send over the image to be added 
with the form entry, the id (as we think of on a Zope object) 
doesn't come over with it.

Hmmmm, perhaps the form <input ... type="file"> doesn't actually 
make it a Zope object, and neither does the Python Product to get 
the file from my local file system??  Which is why, as you 
queried, the property has no where to go but up the Zope 
structure until it finds something that IS an object.

Not sure the above is the best way, but I got it to work.  If 
anyone has a better way (or understanding of this), would love to 
know.

kj

Chris Withers wrote:

> Kevin Jones wrote:
> 
>> #add an author property to image created above
>> doc=getattr(image_folder, id)
>> doc.manage_addProperty('author', author, 'string')
> 
> 
> ...and you're saying that property ends up on the Image's container?
> 
> Very odd :-S
> 
> That SHOULD work as you expect...
> 
> Chris
> 



More information about the Zope mailing list