From ac1a5b1efd54c936de6144e65c08d1f44c939116 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Wed, 8 Feb 2012 14:09:23 +0100 Subject: [PATCH] fix parsing accounts in particular cases --- modules/bp/pages/accountlist.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/bp/pages/accountlist.py b/modules/bp/pages/accountlist.py index 3fbafd97..b6031ddb 100644 --- a/modules/bp/pages/accountlist.py +++ b/modules/bp/pages/accountlist.py @@ -51,9 +51,14 @@ class AccountList(BasePage): account.link_id = tmp.get("href") tmp = line.xpath("./td/span/strong") - tmp_id = tmp[0].text - tmp_balance = tmp[1].text - account.id = tmp_id + if len(tmp) >= 2: + tmp_id = tmp[0].text + tmp_balance = tmp[1].text + else: + tmp_id = line.xpath("./td//span")[1].text + tmp_balance = tmp[0].text + + account.id = tmp_id account.balance = float(''.join(tmp_balance.replace('.','').replace(',','.').split())) self.account_list.append(account)