product development help and tips
Hello, I m developing a product that will do the following: My form has the following: ID, TITLE, FILE fields to fill out. After I have filled out the field, I click submit, I want to create a folder with the file I uploaded within the folder. My folder name will be the id, and the file id will be the file name. Currently, I am able to use my product to create a folder and a file, but I don't know now how to put the file within the folder. Help and tips would be greatly appreciated. Thanks
On Tue, 2003-03-25 at 20:06, Patel, Tejash wrote:
Currently, I am able to use my product to create a folder and a file, but I don't know now how to put the file within the folder.
The best way is to call the file creation method *on* the Folder object you want the file to be put inside. If necessary, it is also possible to cut & paste the file into the folder after it has been created: http://www.zope.org/Members/dylanr/move_obj HTH, Dylan
The general rhythm is as follows (in product module code): class MyClass(SimpleItem, ...): ... def addMyClass(container, id, ...other form fields..., RESPONSE=None): obj = MyClass(id, ...) container._setObject(id, obj) if RESPONSE is not None: RESPONSE.redirect(container.absolute_url() + '/manage_main') addMyClassForm = PageTemplateFile( package_home(globals()) + '/www/addMyClassForm.pt') The key is the _setObject(id, obj) call. That puts the object in the folder. I would recommend looking at the Boring product as an example to. hth, -Casey On Tuesday 25 March 2003 03:06 pm, Patel, Tejash wrote:
Hello,
I m developing a product that will do the following: My form has the following: ID, TITLE, FILE fields to fill out. After I have filled out the field, I click submit, I want to create a folder with the file I uploaded within the folder. My folder name will be the id, and the file id will be the file name.
Currently, I am able to use my product to create a folder and a file, but I don't know now how to put the file within the folder.
Help and tips would be greatly appreciated.
Thanks
participants (3)
-
Casey Duncan -
Dylan Reinhardt -
Patel, Tejash