[ZPT] Using the fmt parameter from DTML ?

Colin Fox cfox@crystalcherry.com
11 Apr 2002 00:43:08 -0700


--=-QM3UyPvNhnuole59C/R6
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2002-04-09 at 13:08, Dieter Maurer wrote:
> Gitte Wange writes:
>  > I am converting some skins from DTML to ZPT.
>  > Here I used something like:
>  > <dtml-var price fmt=3D"%.2f">
>  >
>  > But how do I do this in zpt ?
>=20
> You use Python's "%" operator.
>=20
>     <... tal:content=3D"python: '%.2f' % price" ...>

This is a question I was just about to ask. In DTML, you can say:

Cost per unit: <dtml-var expr=3D"_.float(total_cost/total_units)"=20
fmt=3Ddollars-and-cents>

(from the Zope Book)

Doing it the python %.2f way will work, but ideally we'd want something
that would display in the appropriate currency, localized (commas,
periods, currency symbol, etc).

Is there a way to do this from ZPT, or do I have to create a python
script to do it for me?

--=20
Colin Fox                                       cfox@crystalcherry.com
CF Consulting Inc.                                    GPG Fingerprint:
                    D8F0 84E7 E7CC 5C6C 9982  F1A7 A3EB 6EA3 BC97 572F

--=-QM3UyPvNhnuole59C/R6
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA8tT6Mo+tuo7yXVy8RAg6rAJ0VolOs8ttRVVZPl17L6qumpSnxDgCgyQfB
UjhlonJECqDlOXOWKTZOV0M=
=ikUW
-----END PGP SIGNATURE-----

--=-QM3UyPvNhnuole59C/R6--