[Zope] expression evaluateion

Thomas Weiner weiner@tu-harburg.de
Thu, 16 Mar 2000 11:09:57 +0100


Chien-pin Wang schrieb:
> 
> Hi,
> 
>     Zope seems to evaluate expressions in an unconventional way.
> Say I have three properties, a=3, b=5, c=7 set in a Folder. In
> a DTML Document I tried to say <dtml-var "a/b*c"> and got result
> 0. The expression was evaluated as a/(b*c) and rounded off. Is
> not the expression supposed to be evaluated as (a/b)*3? The
> result is not correct still if we put it this way:
> <dtml-var "(a/b)*3">. I still got 0 as the result. Did I miss
> anything fundamentally or is this a, bug?

You have to convert it from integer to float. Try:

<dtml-var "(_.float(a)/b)*c"> 

Though you're rigth, you need the parenthesis for the correct
evaluation.

hth,
Thomas