[Zope] Newbie: Simple Formatting floats in DTML
Dieter Maurer
dieter@handshake.de
Mon, 24 Mar 2003 19:55:35 +0100
Ashley Lloyd wrote at 2003-3-24 11:48 +0000:
> I know this is a very simple question, but after searching the zope site and
> lists I still have not found an answer.
>
> I need to format a great deal of floating point numbers for accountants to
> read, so need them using thousands_commas and if they are negative, display
> them in parentheses without the - sign.
> eg 1004 = 1,004.00; -25436345.74 = (25,436,345.74)
>
> I could write a python script to do this, but I thought there was probably a
> parameter, similar to thousands_commas, (like negative_brackets, say) that
> could to this for me.
>
> Can anyone confirm this either way?
You need to write the script for the "negative" handling.
You can use the "thousands_comma" from "Products.PythonScripts.standard".
Dieter