[Zope] Getting info about a newly created object

Oleg Broytmann Oleg Broytmann <phd@phd.fep.ru>
Sat, 9 Jun 2001 11:56:47 +0400 (MSD)


On Sat, 9 Jun 2001, Philippe Jadin wrote:
> On a site I want to allow users to add files. I created a simple form that
> has <input type="file"> on it. This form calls a python script with :
>
> context.manage_addProduct['OFSP'].manage_addFile(file)
>
> This doesn't work : it needs two arguments instead of one. It works when I
> give an id. What I'd like is to have the id generated based on the given
> filename.

<untested>
   id = file.filename # not sure about this filename
   context.manage_addProduct['OFSP'].manage_addFile(id, file=file.read(),
      title='XYZ', content_type='text/plain')
</untested>

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.