[Zope] Convert String to object?

Martin Bernhardt bernihard@gmx.net
Tue, 5 Mar 2002 00:21:44 +0100


Hi!

This might be a newbie question but I only started with Zope a few days ago
and came across a problem that some of you might be able to help me with.

I want to create a document management system with 10 different folders that
authenticated users of the system can upload files to. So far, I use two
DTML-methods, one containing an HTML-form (specifying filename, id,
description etc.) and another one to process the form-data and the
file-upload. In the document containing the form, users can specify the
folder they want to upload the file to. In order to find all the possible
folders in the container object I use a <dtml-in
expr="objectValues('Folder')"> - loop. Up to this point, everything works
out fine and users can easily select the desired folder.

My problem is that I have not yet found a way to upload the files to the
CORRECT folder. I have access to the 'id' and 'title' attribute of the
desired folder in my form-processing-method, but how can I convert these
attributes to an object? (My plan was to use Zope-Acquisition and to call
the upload-method on the desired folder-object). Do I  have to convert the
attributes at all or is there another way to upload the files to a folder
different from the current folder without having access to the folder-object
(merely its id in String format (as part of the REQUEST-object))?

To further illustrate the problem, here's the line of code I have trouble
with (taken from the process-form-method: THIS obviously doesn't work :-)

<dtml-call "REQUEST['selectedFolder'].manage_addImage(REQUEST['id'], file,
REQUEST['title'])">

Any help would be greatly appreciated!!!

Cheers,

Martin