From 8e58b7c85134cc86de095090519b7aac41e330cd Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Wed, 30 Oct 2013 23:46:50 +0100 Subject: [PATCH] [hybride] Correct bug on description retrievment --- modules/hybride/pages.py | 15 ++++++++++++--- modules/hybride/test.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/hybride/pages.py b/modules/hybride/pages.py index 43a2baea..eda452a2 100644 --- a/modules/hybride/pages.py +++ b/modules/hybride/pages.py @@ -85,8 +85,17 @@ class EventPage(BasePage): summary = self.parser.select(header, "h2[@class='itemTitle']", 1, method='xpath') event.summary = u'%s' % summary.text_content().strip() - table_description = self.parser.select(div, "div[@class='itemBody']/div[@class='itemFullText']/table/tbody/tr/td", - 1, method='xpath') + description = '' - event.description = u'%s' % table_description.text_content() + description_intro = self.parser.select(div, "div[@class='itemBody']/div[@class='itemIntroText']/table/tbody/tr/td", + method='xpath') + if description_intro and len(description_intro) > 0: + description += u'%s' % description_intro[0].text_content() + + description_content = self.parser.select(div, "div[@class='itemBody']/div[@class='itemFullText']/table/tbody/tr/td", + method='xpath') + if description_content and len(description_content) > 0: + description += u'%s' % description_content[0].text_content() + + event.description = u'%s' % description return event diff --git a/modules/hybride/test.py b/modules/hybride/test.py index 14a70e61..1e409079 100644 --- a/modules/hybride/test.py +++ b/modules/hybride/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from datetime import datetime + class HybrideTest(BackendTest): BACKEND = 'hybride' @@ -29,4 +30,3 @@ class HybrideTest(BackendTest): assert len(l) event = self.backend.get_event(l[0].id, None) self.assertTrue(event.url, 'URL for event "%s" not found: %s' % (event.id, event.url)) -