Convert String to object?
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
Martin Bernhardt wrote:
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)
That's the easiest way to do it. In your link to add a doc, insert the name of the folder where you want to put content. With acquisition, the method will be called in he context of this folder, and will simply add the doc there. hth philippe
Martin Bernhardt writes:
This might be a newbie question but I only started with Zope a few days ago It is indeed.
Please read some background: either the Zope book or <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> In the latter reference, what you look for is called "computed variable access". Dieter
participants (3)
-
Dieter Maurer -
Martin Bernhardt -
Philippe Jadin