[Zope] dtml decimals

Andy McKay andym@ActiveState.com
Wed, 13 Dec 2000 12:23:19 -0800


Well there you go:

<dtml-var "_.float(3)/_.float(2)" fmt="%.2f">

Its a python thing, it sees 3 and casts it as an int, same with 2 and
dividing ints results in an int. You learn something new every day.

--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "Andy McKay" <andym@ActiveState.com>
To: "zope-misc" <zope@zope.org>
Sent: Wednesday, December 13, 2000 10:11 AM
Subject: Re: [Zope] dtml decimals


> Well for one thing that example should be <dtml-var "3/2" fmt="%.2f">
> --
>   Andy McKay, Developer.
>   ActiveState.
>
> ----- Original Message -----
> From: "Andy McKay" <andym@ActiveState.com>
> To: "zope-misc" <zope@zope.org>
> Sent: Wednesday, December 13, 2000 10:03 AM
> Subject: [Zope] dtml decimals
>
>
> > <dtml-var "3/2" fmt="%.2d"> instead of getting 1.50 as I was expecting I
> get
> > 1.00, I never seem to be getting decimals. Whats the obivous thing Im
> > missing here?
> >
> > Cheers.
> >
> > --
> >   Andy McKay, Developer.
> >   ActiveState.
> >
> >
> > _______________________________________________
> > 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 )
> >
>
>
> _______________________________________________
> 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 )
>