Fix compute exponent when value is int and factor Decimal

Some Numeric Function field return integer instead of Decimal, so the test to
convert to Decimal should be on the result of the factor multiplication instead
of the value.

issue5106
review16791003
This commit is contained in:
Cédric Krier committed 2015-11-07 15:59:14 +01:00
1 parent 9092ead1fa
commit 8ebaad2cb5
1 file changed
+2 -2
+2 -2
View File
@@ -327,8 +327,8 @@ class FloatField(Field):
p = digits[1]
else:
d = value * factor
if not isinstance(value, Decimal):
d = Decimal(repr(value * factor))
if not isinstance(d, Decimal):
d = Decimal(repr(d))
p = -int(d.as_tuple().exponent)
return locale.format('%.*f', (p, value * factor), True)
else: