caissedepargne: fix getting card accounts on old website
This commit is contained in:
parent
29738edd29
commit
4cc87efbd2
1 changed files with 5 additions and 19 deletions
|
|
@ -172,26 +172,12 @@ class IndexPage(Page):
|
||||||
if tr.attrib.get('class', '') == 'DataGridHeader':
|
if tr.attrib.get('class', '') == 'DataGridHeader':
|
||||||
account_type = self.ACCOUNT_TYPES.get(tds[1].text.strip(), Account.TYPE_UNKNOWN)
|
account_type = self.ACCOUNT_TYPES.get(tds[1].text.strip(), Account.TYPE_UNKNOWN)
|
||||||
else:
|
else:
|
||||||
label = ''
|
# On the same row, there are many accounts (for example a
|
||||||
i = 1
|
# check accound and a card one).
|
||||||
a = None
|
for i, a in enumerate(tds[2].xpath('./a')):
|
||||||
while label == '' and i < len(tds):
|
|
||||||
a = tds[i].find('a')
|
|
||||||
if a is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
label = self.parser.tocleanstring(a)
|
label = self.parser.tocleanstring(a)
|
||||||
i += 1
|
balance = self.parser.tocleanstring(tds[-2].xpath('./a')[i])
|
||||||
|
self._add_account(accounts, a, label, account_type, balance)
|
||||||
balance = ''
|
|
||||||
i = -1
|
|
||||||
while balance == '' and i > -len(tds):
|
|
||||||
try:
|
|
||||||
balance = self.parser.tocleanstring(tds[i].xpath('./a')[0])
|
|
||||||
except KeyError:
|
|
||||||
balance = u''.join([txt.strip() for txt in tds[i].itertext()])
|
|
||||||
i -= 1
|
|
||||||
self._add_account(accounts, a, label, account_type, balance)
|
|
||||||
|
|
||||||
if len(accounts) == 0:
|
if len(accounts) == 0:
|
||||||
# New website
|
# New website
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue