[hybride] Correct bug on description retrievment

This commit is contained in:
Bezleputh 2013-10-30 23:46:50 +01:00 committed by Florent
commit 8e58b7c851
2 changed files with 13 additions and 4 deletions

View file

@ -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

View file

@ -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))