[weboob] [PATCH 1/1] The account listing is now more robust

Florent weboob at flo.fourcot.fr
Mon Feb 13 10:34:15 CET 2012


Hello, 

actually I didn't write this patch. The new contributor is 
David Jeanneteau.

Regards, 

Florent. 

Signed-off-by: Florent <weboob at flo.fourcot.fr>
---
 modules/ing/pages/accounts_list.py |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/modules/ing/pages/accounts_list.py b/modules/ing/pages/accounts_list.py
index cf36c97..df4ea21 100644
--- a/modules/ing/pages/accounts_list.py
+++ b/modules/ing/pages/accounts_list.py
@@ -34,16 +34,20 @@ class AccountsList(BasePage):
 
     def get_list(self):
         l = []
+        ids = []
         for td in self.document.xpath('.//td[@nowrap="nowrap"]'):
             account = Account()
             link = td.xpath('.//a')[0]
             account.id = re.search('\d', link.attrib['href']).group(0)
-            account.label = link.text
-            urltofind = './/a[@href="' + link.attrib['href'] + '"]'
-            linkbis = self.document.xpath(urltofind).pop() 
-            account.balance = float(linkbis.text.replace('.', '').replace(',','.'))
-            account.coming = NotAvailable
-            l.append(account)
-
-        return l
-
+            if not ( account.id in ids ) :
+                ids.append( account.id )
+                account.label = link.text
+                urltofind = './/a[@href="' + link.attrib['href'] + '"]'
+                linkbis = self.document.xpath(urltofind).pop()
+                if linkbis.text == link.text :
+                    linkbis=self.document.xpath(urltofind)[1]
+                account.balance = float( linkbis.text.replace('.','').replace(' ', '').replace(',','.') )
+                account.coming = NotAvailable
+                l.append(account)
+
+        return l 
-- 
1.7.2.5




More information about the weboob mailing list