[Zope] product development help and tips

Dylan Reinhardt zope@dylanreinhardt.com
25 Mar 2003 15:09:35 +0000


[copied back to the list]

On Tue, 2003-03-25 at 22:20, Patel, Tejash wrote:
> I am trying to develop a product for my site, this is what I want:
> 
> The product will create a folder and within that folder a file will be 
> copied into it. This is all done automatically.

I'm assuming this isn't *all* the product does and that you have
determined you actually want a product...


> What I want I to someone take the IDValues create a folder with this 
> name and the take the uploaded file and copy it into the IDValues 
> folder which was just created, I want to do this all in one shot.

OK.  Here goes.


The form:
----------------------
<form method=post action=my_form_proc enctype="multipart/form-data">
ID: <input type=text name=IDValue><BR>
Title: <input type=text name=TitleValue><BR>
File: <input type=file name=FileData><BR>
<input type=submit>
</form>


Product Method: my_form_proc
---------------------------
def my_form_proc(self, IDValue, TitleValue, FileData, REQUEST=None):
   """ Allow user to add file """
   context.manage_addProduct['OFSP'].manage_addFolder(IDValue)
   context[IDValue].manage_addProduct['OFSP'].manage_addFile(
          id=TitleValue, 
          title='',
          file=FileData)
   if REQUEST:
      return self.some_interface(self, REQUEST)

That's untested, but should get you most of the way there.

HTH,

Dylan