Account.link_id becomes a private attribute

This commit is contained in:
Romain Bignon 2012-03-10 09:03:26 +01:00
commit 35688f58c9
18 changed files with 37 additions and 30 deletions

View file

@ -132,9 +132,9 @@ class Cragr(BaseBrowser):
def get_history(self, account):
# some accounts may exist without a link to any history page
if account.link_id is None:
if account._link_id is None:
return
history_url = account.link_id
history_url = account._link_id
operations_count = 0
# 1st, go on the account page
@ -258,5 +258,5 @@ class Cragr(BaseBrowser):
#def get_coming_operations(self, account):
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
# self.location('/NS_AVEEC?ch4=%s' % account.link_id)
# self.location('/NS_AVEEC?ch4=%s' % account._link_id)
# return self.page.get_operations()

View file

@ -45,11 +45,12 @@ class AccountsList(CragrBasePage):
for div in self.document.getiterator('div'):
if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag in ('a', 'br'):
account = Account()
account._link_id = None
if div.getchildren()[0].tag == 'a':
# This is at least present on CA Nord-Est
# Note: we do not know yet how history-less accounts are displayed by this layout
account.label = ' '.join(div.find('a').text.split()[:-1])
account.link_id = div.find('a').get('href', '')
account._link_id = div.find('a').get('href', '')
account.id = div.find('a').text.split()[-1]
s = div.find('div').find('b').find('span').text
else:
@ -57,12 +58,12 @@ class AccountsList(CragrBasePage):
first_link = div.find('a')
if first_link is not None:
account.label = first_link.text.strip()
account.link_id = first_link.get('href', '')
account._link_id = first_link.get('href', '')
s = div.find('div').find('b').text
else:
# there is no link to any history page for accounts like "PEA" or "TITRES"
account.label = div.findall('br')[0].tail.strip()
account.link_id = None
account._link_id = None
s = div.xpath('following-sibling::div//b')[0].text
account.id = div.findall('br')[1].tail.strip()
account.balance = clean_amount(s)