I'm trying to do an assignment to a variable I created with "let" as follows: <dtml-let pricelist="parseSeminarRegistration(price_dates)" currentPrice="pricelist[0][1]" > <dtml-in pricelist> <dtml-if sequence-key> <dtml-if "_.DateTime() < _.DateTime(_['sequence-key'])"> <dtml-call currentPrice="_['sequence-item']"> </dtml-if> </dtml-if> </dtml-in> The <dtml-call currentPrice="_['sequence-item']"> Doesn't work, I've tried another way or two. I'm sure assignment must be straightforward, but I'm probably missing something obvious. Can someone enlighten? Thanks. Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming@earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar ===================
<dtml-call currentPrice="_['sequence-item']">
What is this meant to do? <dtml-call> does not support assignment and does not return anything. If you are trying to print just <dtml-var sequence-item> will do. This really looks a job for a python script, not for dtml. Cheers. -- Andy McKay. ----- Original Message ----- From: "Bruce Eckel" <Bruce@EckelObjects.com> To: <chrism@digicool.com> Cc: <zope@zope.org> Sent: Wednesday, May 23, 2001 3:28 PM Subject: [Zope] Simple assignment (?)
I'm trying to do an assignment to a variable I created with "let" as follows:
<dtml-let pricelist="parseSeminarRegistration(price_dates)" currentPrice="pricelist[0][1]" >
<dtml-in pricelist> <dtml-if sequence-key> <dtml-if "_.DateTime() < _.DateTime(_['sequence-key'])"> <dtml-call currentPrice="_['sequence-item']"> </dtml-if> </dtml-if> </dtml-in>
The <dtml-call currentPrice="_['sequence-item']"> Doesn't work, I've tried another way or two.
I'm sure assignment must be straightforward, but I'm probably missing something obvious. Can someone enlighten? Thanks.
Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming@earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar ===================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
----- Original Message ----- From: "Bruce Eckel" <Bruce@EckelObjects.com>
The <dtml-call currentPrice="_['sequence-item']"> Doesn't work, I've tried another way or two.
How about <dtml-call "REQUEST.set('currentPrice',_['sequence-item'])">
On Wed, 23 May 2001, marc lindahl wrote:
----- Original Message ----- From: "Bruce Eckel" <Bruce@EckelObjects.com>
The <dtml-call currentPrice="_['sequence-item']"> Doesn't work, I've tried another way or two.
How about
<dtml-call "REQUEST.set('currentPrice',_['sequence-item'])">
This is the way it should be done in DTML, but really, your code screams to be rewritten in python. DTML is not meant to do things like this. Wouldn't you prefer: for date, price in pricelist: if date and (DateTime() < DateTime(date)): currentPrice = price return currentPrice instead of: <dtml-in pricelist> <dtml-if sequence-key> <dtml-if "_.DateTime() < _.DateTime(_['sequence-key'])"> <dtml-call currentPrice="_['sequence-item']"> </dtml-if> </dtml-if> </dtml-in> -Michel
Hi Bruce, I'm not sure if it's the most elegant way to do it, but could try defining currentPrice with a call to REQUEST.set() rather than in the Let tag. The first REQUEST.set would initialize currentPrice (maybe not necessary?), then you could reassign the value using another REQUEST.set in your DateTime logic. Something like:
<dtml-let pricelist="parseSeminarRegistration(price_dates)">
<dtml-in pricelist> <dtml-if sequence-key> <dtml-if "_.DateTime() < _.DateTime(_['sequence-key'])"> <dtml-call expr="REQUEST.set('currentPrice',_['sequence-item'])"> </dtml-if> </dtml-if> </dtml-in>
Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Bruce Eckel Sent: Wednesday, May 23, 2001 3:29 PM To: chrism@digicool.com Cc: zope@zope.org Subject: [Zope] Simple assignment (?)
I'm trying to do an assignment to a variable I created with "let" as follows:
<dtml-let pricelist="parseSeminarRegistration(price_dates)" currentPrice="pricelist[0][1]" >
<dtml-in pricelist> <dtml-if sequence-key> <dtml-if "_.DateTime() < _.DateTime(_['sequence-key'])"> <dtml-call currentPrice="_['sequence-item']"> </dtml-if> </dtml-if> </dtml-in>
The <dtml-call currentPrice="_['sequence-item']"> Doesn't work, I've tried another way or two.
I'm sure assignment must be straightforward, but I'm probably missing something obvious. Can someone enlighten? Thanks.
participants (5)
-
Andy McKay -
Bruce Eckel -
Eric Walstad -
marc lindahl -
Michel Pelletier