From 5d82484c48d44e7f54972bad84f19287cfd632a6 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 28 Dec 2012 18:34:18 +0100 Subject: [PATCH] get better account ids --- modules/cmso/pages.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/cmso/pages.py b/modules/cmso/pages.py index 568a0a8e..26805743 100644 --- a/modules/cmso/pages.py +++ b/modules/cmso/pages.py @@ -39,10 +39,14 @@ class LoginPage(BasePage): class AccountsPage(BasePage): def get_list(self): + names = set() for li in self.document.xpath('//div[@class="affichMontant"]/ul/li/a'): account = Account() - account.id = li.attrib['accesskey'] account.label = unicode(li.cssselect('div.row-lib u')[0].text.strip()) + account.id = re.sub('[ \.\-]+', '', account.label) + while account.id in names: + account.id = account.id + '1' + names.add(account.id) account.balance = Decimal(li.cssselect('p.row-right')[0].text.strip().replace(' ', '').replace(',', '')) account._link = li.attrib['href'] yield account