Am 05.01.2013 16:47, schrieb D'Arcy J.M. Cain:
On Sat,  5 Jan 2013 10:07:58 -0500 (EST)
[email protected] wrote:
Handle money results properly when decimal point is a','.

I didn't see the unit test changes.  I assume that they are tied up
with your insert/update changes and you are holding them until that is
finished.  What about this?

That was an independent problem that existed already before. PyGreSQL converts money from string to Decimal on output. But in doing so, it assumed the decimal point is a '.' which is not always true. For instance, with a German locale the output would be "12.345,67 €".

> finished.  What about this?
>
> 123,456

Postgres would not create such an output, it would create $123,456.00 or "123.456,00 €". Except maybe when you have a locale where frag_digits = 0 (i.e. a currency that has no cents/pennies or similar).

A cleaner solution would get the decimal_point from localeconv(). But even that may not be good enough (thread safety, lc_monetary could be set to a different value for the connection etc.). Not sure if there is an official way to get this information.

-- Chris




_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to