[Zope] Funny problem with DTML, please help!
pan@aster.net
pan@aster.net
20 Apr 1999 07:39:15 +0300
Hi guys,
I hope someone can help me with this one, because it's almost driving
me crazy :-)
The following code fails with an error for count_yes:
<!--#comment-->
Calculate the vote percentage
<!--#/comment->
<!--#call "REQUEST.set('count_yes', 0)"-->
<!--#call "REQUEST.set('count_no', 0)"-->
<!--#call "REQUEST.set('count_all', 0)"-->
<!--#in sql_distinct_votes-->
<!--#if "cnt == 1"-->
<!--#if "answer == 'Y'"-->
<!--#call "REQUEST.set('count_yes', REQUEST['count_yes']+cnt)"-->
<!--#/if-->
<!--#if "answer == 'N'"-->
<!--#call "REQUEST.set('count_no', REQUEST['count_no']+cnt)"-->
<!--#/if-->
<!--#call "REQUEST.set('count_all', REQUEST['count_all']+cnt)"-->
<!--#/if-->
<!--#/in-->
<!--#comment-->
Now display the results
<!--#/comment-->
<h2> Total : <!--#var "REQUEST['count_all']"--> votes</h2>
<ul>
<li>Yes : <!--#var "REQUEST['count_yes']"--> votes (<!--#var "_.round(((REQUEST['count_yes']+0.0)/REQUEST['count_all'])*100,1)"-->%)</li>
<li>No : <!--#var "REQUEST['count_no']"--> votes (<!--#var "_.round(((REQUEST['count_no']+0.0)/REQUEST['count_all'])*100,1)"-->%)</li>
</ul>
When I change
<!--#call "REQUEST.set('count_yes', REQUEST['count_yes']+cnt)"-->
to
<!--#call "REQUEST.set('count_yes', cnt)"-->
it works as expected, no errors, but that's not what I want :-( I've
tried, superstitiously, to change count_yes to several other things,
but no luck. It always gives me an error for the vairable I
substitute for count_yes. The strangest thing is that the same code
works for count_no and count_all ?!?
Any ideas?