[Zope] Handling of Multiple :list's

Julian Clark Julian.Clarke@b-online.com.au
Fri, 18 Jul 2003 11:31:19 +0800


Hi Chris...
I don't know enough python yet, I've only just downloaded the latest runtime. gotta get me some learning now ;)
I realised that I really didn't want (or need)  to iterate the second  loop inside the first loop.
this was what I did in the end

<!--#in amountlist -->
<dtml-call "REQUEST.set('listnum',_['sequence-index'])">
<!--#in amountlist -->
<dtml-if "_['sequence-index']==_['listnum']">
<dtml-call "REQUEST.set('amount',_['sequence-item'])">
<!--#/if -->
<!--#/in -->
<!--#in marketinglist -->
<dtml-if "_['sequence-index']==_['listnum']">
<dtml-call "REQUEST.set('dealer_code',_['sequence-item'])">
<!--#/if -->
<!--#/in -->
<!--#call amend_holding_table -->
<!--#/in -->

amend_holding table is a zSQL method
Update mHoldingTable
set
amount = <dtml-sqlvar amount type=string>
where
dealer_code = <dtml-sqlvar dealer_code type=string>


How would I implement a python script to do this as you've suggested, can i just call it from within a dtml method?


Thanks

Julian



----- Original Message ----- 
From: "Chris Withers" <chrisw@nipltd.com>
To: "Julian Clark" <Julian.Clarke@b-online.com.au>
Cc: "zope" <zope@zope.org>
Sent: Thursday, July 17, 2003 8:25 PM
Subject: Re: [Zope] Handling of Multiple :list's


Julian Clark wrote:
> <!--#in amountlist -->
> <!--#in marketinglist -->
> <dtml-call "REQUEST.set('amount',_['sequence-item'])">   // using amount list
> <dtml-call "REQUEST.set('dealer_no',_['sequence-item'])"> // using marketing list
> <!--#call amend_holding_table -->
> <!--#/in -->
> <!--#/in -->

Eeek! This really should be a python script...

parameters: amountlist, marketinglist

for a in amountlist:
   for m in markinglist:
      context.amend_holding_table(amount=a,deal_no=m)

what is amend_holding_table? DTML? ZSQL?

cheers,

Chris