fix parsing of amounts

This commit is contained in:
Romain Bignon 2011-09-22 18:05:47 +02:00
commit d67b6449d1
3 changed files with 5 additions and 5 deletions

View file

@ -57,7 +57,7 @@ class AccountComing(BasePage):
if m: if m:
label = text % m.groupdict() label = text % m.groupdict()
amount = tds[2].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n') amount = tds[2].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r')
operation = Operation(len(self.operations)) operation = Operation(len(self.operations))
operation.date = d operation.date = d

View file

@ -55,8 +55,8 @@ class AccountHistory(BasePage):
if ' ' in op.label: if ' ' in op.label:
op.category, useless, op.label = [part.strip() for part in op.label.partition(' ')] op.category, useless, op.label = [part.strip() for part in op.label.partition(' ')]
debit = tr.xpath('.//td[@class="debit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n') debit = tr.xpath('.//td[@class="debit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r')
credit = tr.xpath('.//td[@class="credit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n') credit = tr.xpath('.//td[@class="credit"]')[0].text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r')
if len(debit) > 0: if len(debit) > 0:
op.amount = - float(debit) op.amount = - float(debit)
else: else:

View file

@ -45,9 +45,9 @@ class AccountsList(BasePage):
account.label = tr.xpath('.//td[@class="libelleCompte"]/a')[0].text.strip() account.label = tr.xpath('.//td[@class="libelleCompte"]/a')[0].text.strip()
tds = tr.findall('td') tds = tr.findall('td')
account.balance = float(tds[3].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n')) account.balance = float(tds[3].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r'))
if tds[4].find('a') is not None: if tds[4].find('a') is not None:
account.coming = float(tds[4].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n')) account.coming = float(tds[4].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r'))
l.append(account) l.append(account)
if len(l) == 0: if len(l) == 0: