R: R: [Zope] How to create a file from a form?

Casey Duncan c.duncan@nlada.org
Thu, 18 Oct 2001 08:48:57 -0400


On Thursday 18 October 2001 06:11 am, Paolo D'Aubert allegedly wrote:
> I tryed to use this method but doesn't works... :(
>
> Any other help?
>
> This is the code I'm using..
[sni[p]
>
> And the page after the submit:
>
> <dtml-call "manage_addDTMLDocument(Nome,bello)">
> <dtml-call expr="Nome.manage_edit(pippo,pluto)">
>
> Thanx!
>

Remember, Nome is a string value coming from the form. You can't call 
manage_edit on a string. You can use getitem to lookup the object given its 
id string to do what you want:

<dtml-call expr="manage_addDTMLDocument(Nome,bello)">
<dtml-call expr="_.getitem(Nome).manage_edit(pippo,pluto)">

I might suggest coding this as a Python script tho, which would make it a bit 
simpler:

context.manage_addDTMLDocument(Nome,bello)
doc = context[Nome]
doc.manage_edit(pippo,pluto)

The script will need Nome, bello, pippo, pluto as parameters. You'll notice 
that the syntax is nearly the same, minus all the <dtml-call > crap.

hth,
/---------------------------------------------------\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  c.duncan@nlada.org
\---------------------------------------------------/