[Zope-DB] Help needed with multi-table insert form

Charlie Clark charlie@begeistert.org
Thu, 23 Jan 2003 10:03:48 +0100


On 2003-01-23 at 01:13:58 [+0100], Martin Gebert wrote:
> >insert_d = {}
> >for item, value in request.form.items():
> >   if item == status:
> >   ....
> >   insert_d[item] = value
> >
> >context.sql_method(insert_d)      
> >  
> >
> Interesting method, Charlie :-) Live and learn...

> @Norman: Alternatively (and more obvious), you could also use a script 
> like
> 
> request = context.REQUEST
> 
> context.sql_INSERT_form(
>     business_name = request.business_name,
>     ...
>     )

sure but this method doesn't allow the form to be checked. If you're going 
to do this you might as well pass the REQUEST.form which is a dictionary 
directly.

context.sql_INSERT_form(request.form)

Charlie