fixing account without amount
This commit is contained in:
parent
f3f19f450f
commit
9a3258419d
1 changed files with 9 additions and 2 deletions
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
from decimal import Decimal
|
from decimal import Decimal, InvalidOperation
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from weboob.tools.browser import BasePage as _BasePage, BrowserUnavailable, BrokenPageError
|
from weboob.tools.browser import BasePage as _BasePage, BrowserUnavailable, BrokenPageError
|
||||||
|
|
@ -150,7 +150,11 @@ class AccountsPage(BasePage):
|
||||||
else:
|
else:
|
||||||
account.currency = account.get_currency(m.group(1))
|
account.currency = account.get_currency(m.group(1))
|
||||||
|
|
||||||
account.balance = Decimal(FrenchTransaction.clean_amount(u''.join([txt.strip() for txt in box.cssselect("td.montant")[0].itertext()])))
|
try:
|
||||||
|
account.balance = Decimal(FrenchTransaction.clean_amount(u''.join([txt.strip() for txt in box.cssselect("td.montant")[0].itertext()])))
|
||||||
|
except InvalidOperation:
|
||||||
|
#The account doesn't have a amount
|
||||||
|
pass
|
||||||
account._args = args
|
account._args = args
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
@ -261,6 +265,9 @@ class CBTransactionsPage(TransactionsPage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
tables = self.document.xpath('//table[@id="idDetail:dataCumulAchat"]')
|
tables = self.document.xpath('//table[@id="idDetail:dataCumulAchat"]')
|
||||||
transactions =list()
|
transactions =list()
|
||||||
|
|
||||||
|
if len(tables) == 0:
|
||||||
|
return transactions
|
||||||
for tr in tables[0].xpath('.//tr'):
|
for tr in tables[0].xpath('.//tr'):
|
||||||
tds = tr.findall('td')
|
tds = tr.findall('td')
|
||||||
if len(tds) < 3:
|
if len(tds) < 3:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue