On Sat, 2008-11-29 at 04:59 -0800, Ulf Kronman wrote:
> Hi again,
> a follow up:
> 
> It seems as if it is a design decision from the pymsql developers to
> return Decimal for BIGINT (sorry; not longint, as I said before). It
> is documented here:
> 
> <cite src= 
> http://freshmeat.net/projects/pymssql/?branch_id=59462&release_id=205925
> >
> big numbers (MONEY, SMALLMONEY, DECIMAL, NUMERIC, BIGINT) are returned
> as decimal so no precision is lost.
> </cite>

Because it's so common to lose precision from *integer* values by
storing them in a Python integer ... not! That's a really poor decision:
let's add overhead for no logical reason. :-(

Not your fault, I realise, but it's a stupid thing. Still, it
fortunately reveals a problem somewhere, so something good has come of
it.

> So my guess would be that the combination of this decision and my use
> of pymssql together with Django on a Windows XP environment with
> Swedish locale is the cause of the problem when Decimal causes a
> locale lookup (if that presumption is correct).

The presumption isn't correct. Read the source of the decimal module for
confirmation.

> Could I possibly solve this situation by calling setlocale to set it
> back to US or C after the database has returned its result?

Calling setlocale() would introduce a second (or third) bug into the
code.

> 
> I presume the check of not-a-number introduced in Django v9369 is
> correct, and that my previous locale-incorrect numbers slipped through
> and somehow got handled by the templates floatformat before this check
> was introduced.

As I've noted earlier (I'm only repeating here, because the thread seems
to have bifurcated and I'm trying to pull it back together), I don't
think there's a Django bug here. It just happens to be appearing because
of that change, but that's just the consequence of the bug revealing
itself. The root cause is something else (that's my way of saying this
change shouldn't be reverted because of this report, since we don't
understand the cause yet and it should be fixed at the source once we do
understand it).

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to