From 17d2c732a87f92b7bc09a019adce9687a49a3576 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Thu, 21 Mar 2013 12:23:17 +0100 Subject: [PATCH] fix parsing of CEL accounts --- modules/cragr/web/pages.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/cragr/web/pages.py b/modules/cragr/web/pages.py index dc5fa499..5d552722 100644 --- a/modules/cragr/web/pages.py +++ b/modules/cragr/web/pages.py @@ -130,10 +130,16 @@ class TransactionsPage(BasePage): def get_history(self, date_guesser): i = 0 for tr in self.document.xpath('//table[@class="ca-table"]//tr'): + parent = tr.getparent() + while parent is not None and parent.tag != 'table': + parent = parent.getparent() + + if parent.attrib.get('class', '') != 'ca-table': + continue + if tr.attrib.get('class', '') == 'tr-thead': for i, head in enumerate(tr.findall('th')): key = self.parser.tocleanstring(head) - print '%r = %s' % (key, i) if key == u'Débit': self.COL_DEBIT = i if key == u'Crédit':