I am trying to use ZipFolder (http://zope.org/Members/snej/ZipFolder) to upload and unpack a zip file. It seems to work fine when used from the ZMI but I would like to use it outside of the ZMI. I managed to find the dhtml files used in the ZMI but I am having trouble adapting them. Any place where this is working outside of the ZMI? Samples? Other strategies?
Brian Sullivan wrote at 2003-12-13 13:38 -0500:
I am trying to use ZipFolder (http://zope.org/Members/snej/ZipFolder) to upload and unpack a zip file.
It seems to work fine when used from the ZMI but I would like to use it outside of the ZMI. I managed to find the dhtml files used in the ZMI but I am having trouble adapting them.
When you look at such sources, you want to analyse the form controls ("input" tags of all kinds) and the form action. The action tells you about the method/action script that is activated, the form controls about the relevant arguments. "DocFinder" may also help (to get a description including arguments for the respective method). After this analysis, you forget about the ZMI form and activate the action script/method yourself (either from one of your forms or from a script). <http://www.dieter.handshake.de/pyprojects/zope> -- Dieter
Brian Sullivan wrote at 2003-12-13 13:38 -0500:
I am trying to use ZipFolder
(http://zope.org/Members/snej/ZipFolder)
to upload and unpack a zip file.
It seems to work fine when used from the ZMI but I would like to use it outside of the ZMI. I managed to find the dhtml files used in the ZMI but I am having trouble adapting them.
When you look at such sources, you want to analyse the form controls ("input" tags of all kinds) and the form action.
The action tells you about the method/action script that is activated, the form controls about the relevant arguments. "DocFinder" may also help (to get a description including arguments for the respective method).
After this analysis, you forget about the ZMI form and activate the action script/method yourself (either from one of your forms or from a script).
I must be missing some fundamental bit of information here -- I have DocFinder installed and have looked at the ZMI interfaces and the information provided by DocFinder but still can't figure out what I have to do. I am still looking for clues. Is there anyone out there that has used the ZipFolder product other than via the ZMI?
Brian Sullivan wrote at 2003-12-16 11:21 -0500:
... ZipFolder use programmatically ... [DM] ... look at the ZMI source ...
I must be missing some fundamental bit of information here -- I have DocFinder installed and have looked at the ZMI interfaces and the information provided by DocFinder but still can't figure out what I have to do.
I am still looking for clues.
Is there anyone out there that has used the ZipFolder product other than via the ZMI?
I did not see a response on the mailing list. You may need to look yourself into your problem... I can help only with general (quite abstract) advice: When you use the ZMI, a form works together with an action. The form collects the data necessary for the action. When the form is submitted, the action is called with the collected data. The action does the required operation. When you want to do the operation from your own code (a script or a form of yourself), you need to know the action and the required arguments. Usually, you learn about the action from the "form" elements "action" attribute. Often, part of the action is coded in ":method" or ":action" form control elements. The "input" elements inside the "form" element provide the parameters for the action call. Example: File edit: The form's source is "OFS/dtml/fileEdit.dtml". It looks like ... <form action="<dtml-var URL1>" method="post" enctype="multipart/form-data"> ... <input type="text" name="title" ...> ... <input type="text" name="content_type:required" ...> ... <input type="text" name="precondition" ...> ... <input class="form-element" type="submit" name="manage_edit:method" value="Save Changes"> ... <input type="file" name="file" size="25" /> ... <input class="form-element" type="submit" name="manage_upload:method" value="Upload"> ... </form> This is an example where the action is not specified by the form's "action" attribute but by the ":method" in one of "input" elements. The form is submitted by either pressing the button "Save Changes" or "Upload". In the first case, the action is "manage_edit" in the second "manage_upload". The form collects data with names "title", "content_type", "precondition", "file" ... These data items are available for the actions. "DocFinder" tells you the signature (its arguments) of the actions: manage_edit(self, title, content_type, precondition='', filedata=None, REQUEST=None) manage_upload(self, file='', REQUEST=None) Form info and action signature together give you quite a good insight how to use the actions in your own software... In the example: you can use "fileObject.manage_upload(someFile)" to change "fileObject"'s content to "someFile" and "fileObject.manage_edit(title, content_type, precondition)" to change its "meta data". A similar analysis for ZipFolder is left to you as an exercise (I cannot help you with this, as I do not have ZipFolder" installed; but it should not be difficult...) -- Dieter
I did not see a response on the mailing list. You may need to look yourself into your problem...
Thanks for your detailed response -- I did get a solution to the problem -- the author of the product kindly provided me with a sample that helped me over the hump. Your post will be useful as well to further my general knowledge. Thanks again for the extra effort.
participants (2)
-
Brian Sullivan -
Dieter Maurer