use decimal.Decimal instead of float to store amounts of money
This commit is contained in:
parent
32b87b47f5
commit
b157e92d5b
28 changed files with 111 additions and 69 deletions
|
|
@ -18,6 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from decimal import Decimal
|
||||
import re
|
||||
import datetime
|
||||
|
||||
|
|
@ -53,9 +54,9 @@ class FrenchTransaction(Transaction):
|
|||
debit = self.clean_amount(debit)
|
||||
|
||||
if len(debit) > 0:
|
||||
self.amount = - float(debit)
|
||||
self.amount = - Decimal(debit)
|
||||
else:
|
||||
self.amount = float(credit)
|
||||
self.amount = Decimal(credit)
|
||||
|
||||
def parse(self, date, raw):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
from __future__ import with_statement
|
||||
|
||||
from ConfigParser import RawConfigParser, DEFAULTSECT
|
||||
from decimal import Decimal
|
||||
import logging
|
||||
import os
|
||||
|
||||
|
|
@ -70,7 +71,7 @@ class INIConfig(IConfig):
|
|||
def save(self):
|
||||
def save_section(values, root_section=self.ROOTSECT):
|
||||
for k, v in values.iteritems():
|
||||
if isinstance(v, (int, float, basestring)):
|
||||
if isinstance(v, (int, Decimal, float, basestring)):
|
||||
if not self.config.has_section(root_section):
|
||||
self.config.add_section(root_section)
|
||||
self.config.set(root_section, k, unicode(v))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue