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

Charlie Clark charlie@begeistert.org
Wed, 22 Jan 2003 23:58:17 +0100


On 2003-01-22 at 22:40:38 [+0100], Norman Khine wrote:
> thanks martin,
> i've got it working, by changing the resellerAdd.dtml method to
> 
> <dtml-call "sql_INSERT_form(
>            business_name=3Dbusiness_name,
>            business_url=3Dbusiness_url,
>            business_type_id=3Dbusiness_type_id,
>            street_name=3Dstreet_name,
>            town=3Dtown,
>            city=3Dcity,
>            postcode=3Dpostcode,
>            county_id=3Dcounty_id,
>            title=3Dtitle,
>            initials=3Dinitials,
>            fname=3Dfname,
>            surname=3Dsurname,
>            telephone=3Dtelephone,
>            fax=3Dfax,
>            email=3Demail,
>            regdate=3Dregdate,
>            status =3Dstatus ,
>            job_function_id=3Djob_function_id
> )">
> 
> but i would like to know how to do this using the REQUEST object via a 
> python script.

dead easy.

Get your form to call the script (process_form)
The script looks a bit like this.

request =3D context.REQUEST
context.sql_method(request.form)

of course you might want to check your values so the following might be 
useful

insert_d =3D {}
for item, value in request.form.items():
=09if item =3D=3D status:
=09....
=09insert_d[item] =3D value

context.sql_method(insert_d)=09=09

Charlie