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
|
||||
from datetime import date
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
|
@ -52,7 +53,7 @@ class AccountHistoryCC(BasePage):
|
|||
|
||||
amount = texte[5].replace('\t', '').strip().replace(u'€', '').\
|
||||
replace(',', '.').replace(u'\xa0', u'')
|
||||
op.amount = float(amount)
|
||||
op.amount = Decimal(amount)
|
||||
|
||||
self.transactions.append(op)
|
||||
i += 1
|
||||
|
|
@ -81,7 +82,7 @@ class AccountHistoryLA(BasePage):
|
|||
amount = texte[length - 1].replace('\t', '').strip().\
|
||||
replace('.', '').replace(u'€', '').\
|
||||
replace(',', '.').replace(u'\xa0', u'')
|
||||
op.amount = float(amount)
|
||||
op.amount = Decimal(amount)
|
||||
|
||||
self.transactions.append(op)
|
||||
i += 1
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from decimal import Decimal
|
||||
import re
|
||||
|
||||
from weboob.capabilities.bank import Account
|
||||
|
|
@ -46,8 +47,8 @@ class AccountsList(BasePage):
|
|||
linkbis = self.document.xpath(urltofind).pop()
|
||||
if linkbis.text == link.text:
|
||||
linkbis = self.document.xpath(urltofind)[1]
|
||||
account.balance = float(linkbis.text.replace('.', '').\
|
||||
replace(' ', '').replace(',', '.'))
|
||||
account.balance = Decimal(linkbis.text.replace('.', '').\
|
||||
replace(' ', '').replace(',', '.'))
|
||||
account.coming = NotAvailable
|
||||
l.append(account)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue