Commit 3f85dc0b authored by Romain Bignon's avatar Romain Bignon

fix when lefigaro's feed is wrong

parent 63398eba
......@@ -20,8 +20,10 @@
from .pages.article import ArticlePage
from .pages.flashactu import FlashActuPage
from weboob.tools.browser import BaseBrowser
from weboob.tools.browser import BaseBrowser, BasePage
class IndexPage(BasePage):
pass
class NewspaperFigaroBrowser(BaseBrowser):
......@@ -30,6 +32,7 @@ class NewspaperFigaroBrowser(BaseBrowser):
"http://www.lefigaro.fr/flash-.*/(\d{4})/(\d{2})/(\d{2})/(.*$)": FlashActuPage,
"http://www.lefigaro.fr/bd/(\d{4})/(\d{2})/(\d{2})/(.*$)": FlashActuPage,
"http://www.lefigaro.fr/(?!flash-|bd).+/(\d{4})/(\d{2})/(\d{2})/(.*$)": ArticlePage,
"http://www.lefigaro.fr/": IndexPage,
}
def is_logged(self):
......@@ -44,4 +47,6 @@ class NewspaperFigaroBrowser(BaseBrowser):
def get_content(self, _id):
"return page article content"
self.location(_id)
if self.is_on_page(IndexPage):
return None
return self.page.get_article(_id)
......@@ -44,6 +44,9 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
with self.browser:
content = self.browser.get_content(_id)
if content is None:
return None
if not thread:
thread = Thread(_id)
......@@ -77,7 +80,8 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
def fill_thread(self, thread, fields):
"fill the thread"
return self.get_thread(thread)
t = self.get_thread(thread)
return t or thread
def iter_unread_messages(self, thread=None):
for thread in self.iter_threads():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment