From 10c9aa088f4c1fd48dacaba32e4c87d6833f465c Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 19 Jun 2010 15:06:56 +0200 Subject: [PATCH] fix profile parsing --- weboob/backends/aum/pages/profile.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/weboob/backends/aum/pages/profile.py b/weboob/backends/aum/pages/profile.py index 90ab8325..d438fb74 100644 --- a/weboob/backends/aum/pages/profile.py +++ b/weboob/backends/aum/pages/profile.py @@ -330,24 +330,26 @@ class ProfilePage(PageBase, Profile): value1 = '' value2 = '' # Check for first column - if len(tds[0].childNodes) > 2: - b = tds[0].childNodes[2] - if hasattr(b, 'tagName') and b.tagName == 'b': + if len(tds[0].childNodes) > 0: + b = len(tds[0].childNodes) > 2 and tds[0].childNodes[2] + if b and hasattr(b, 'tagName') and b.tagName == 'b': for child in b.childNodes: label1 += child.data else: - for child in tds[0].childNodes[2:]: - value1 += child.data + for child in tds[0].childNodes: + if child.data != u'\xa0': # strip nbsp + value1 += child.data + value2 = value2.strip() # Check for second column - if len(tds[1].childNodes) > 2: - b = tds[1].childNodes[2] - if hasattr(b, 'tagName') and b.tagName == 'b': + if len(tds[1].childNodes) > 0: + b = tds[1].childNodes[0] + if b and hasattr(b, 'tagName') and b.tagName == 'b': for child in b.firstChild.childNodes: label2 += child.data else: - for child in tds[1].childNodes[2:]: - if hasattr(child, 'data'): + for child in tds[1].childNodes: + if hasattr(child, 'data') and child.data != u'\xa0': # strip nbsp value2 += child.data if label1 and value2: