[Zope] Upload files, set properties, search props

Paul Winkler pw_lists@slinkp.com
Mon, 19 May 2003 17:43:57 -0400


On Mon, May 19, 2003 at 07:52:47PM -0500, John Toews wrote:
> Thank you, pointing out I could do this without a Zclass is going to
> save me time... The one thing I don't understand right now. The code
> below adds a property to the containing folder, not the object I just
> uploaded. How do I obtain the id so I can deal with that? (objects is
> the name of my folder, it is a level under the script itself)
> 
> <dtml-call expr="objects.manage_addFile(id='', file=file,
> title='test')">

well, you need an actual id there. let's say it's spam.
then the next line becomes:

<dtml-call expr="objects.spam.manage_addProperty('keywords', keywords, 
'text')">

but since the id is a variable, you'll probably end up using the 
dictionary item spelling instead of attribute spelling. let's
say you have the id in a variable "file_id":

<dtml-call expr="objects[file_id].manage_addProperty('keywords', keywords, 
'text')">


Finally, since you're already writing python syntax, you might
consider freeing it from those dtml-call expressions and
putting it in a Python Script instead.
This is almost always nicer to read and maintain.

-- 

Paul Winkler
home:  http://www.slinkp.com
"Muppet Labs, where the future is made - today!"