[Zope-DB] Help needed with multi-table insert form
Martin Gebert
Murphy@members.netsolution-net.de
Thu, 23 Jan 2003 01:13:58 +0100
Charlie Clark schrieb:
>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=business_name,
>> business_url=business_url,
>> business_type_id=business_type_id,
>> street_name=street_name,
>> town=town,
>> city=city,
>> postcode=postcode,
>> county_id=county_id,
>> title=title,
>> initials=initials,
>> fname=fname,
>> surname=surname,
>> telephone=telephone,
>> fax=fax,
>> email=email,
>> regdate=regdate,
>> status =status ,
>> job_function_id=job_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 = context.REQUEST
>context.sql_method(request.form)
>
>of course you might want to check your values so the following might be
>useful
>
>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,
...
)
Martin