never convert a float to Decimal
This commit is contained in:
parent
20835e5180
commit
22c2210fe7
4 changed files with 4 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ class AccountsList(BasePage):
|
||||||
if balance != "":
|
if balance != "":
|
||||||
account.balance = Decimal(balance)
|
account.balance = Decimal(balance)
|
||||||
else:
|
else:
|
||||||
account.balance = Decimal(0.0)
|
account.balance = Decimal(0)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# because of some weird useless <tr>
|
# because of some weird useless <tr>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ def clean_amount(amount):
|
||||||
"""
|
"""
|
||||||
data = amount.replace(',', '.').replace(' ', '').replace(u'\xa0', '')
|
data = amount.replace(',', '.').replace(' ', '').replace(u'\xa0', '')
|
||||||
matches = re.findall('^(-?[0-9]+\.[0-9]{2}).*$', data)
|
matches = re.findall('^(-?[0-9]+\.[0-9]{2}).*$', data)
|
||||||
return Decimal(matches[0]) if (matches) else Decimal(0.0)
|
return Decimal(matches[0]) if (matches) else Decimal(0)
|
||||||
|
|
||||||
|
|
||||||
class AccountsList(CragrBasePage):
|
class AccountsList(CragrBasePage):
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class HistoryPage(BasePage):
|
||||||
try:
|
try:
|
||||||
detail.price = Decimal(tds[4].text[0:4].replace(',', '.'))
|
detail.price = Decimal(tds[4].text[0:4].replace(',', '.'))
|
||||||
except:
|
except:
|
||||||
detail.price = Decimal(0.0)
|
detail.price = Decimal(0)
|
||||||
|
|
||||||
self.calls.append(detail)
|
self.calls.append(detail)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class AccountsList(BasePage):
|
||||||
balance = balance.replace(u'\xa0','').replace(',','.')
|
balance = balance.replace(u'\xa0','').replace(',','.')
|
||||||
account.balance = Decimal(balance)
|
account.balance = Decimal(balance)
|
||||||
else:
|
else:
|
||||||
account.balance = Decimal(0.0)
|
account.balance = Decimal(0)
|
||||||
|
|
||||||
l.append(account)
|
l.append(account)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue