fix when I can't get articles
This commit is contained in:
parent
f776214507
commit
707cd69e4b
1 changed files with 12 additions and 5 deletions
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from weboob.backend import BaseBackend
|
from weboob.backend import BaseBackend, BrowserUnavailable
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||||
|
|
||||||
from .feeds import ArticlesList
|
from .feeds import ArticlesList
|
||||||
|
|
@ -70,14 +70,18 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||||
if thread_wanted and thread_wanted != article.id:
|
if thread_wanted and thread_wanted != article.id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
thread = self.browser.get_content(article.id)
|
|
||||||
|
|
||||||
if not article.id in self.storage.get('seen', what, default={}):
|
if not article.id in self.storage.get('seen', what, default={}):
|
||||||
seen[article.id] = {'comments': []}
|
seen[article.id] = {'comments': []}
|
||||||
new = True
|
new = True
|
||||||
else:
|
else:
|
||||||
seen[article.id] = self.storage.get('seen', what, article.id, default={})
|
seen[article.id] = self.storage.get('seen', what, article.id, default={})
|
||||||
new = False
|
new = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
thread = self.browser.get_content(article.id)
|
||||||
|
except BrowserUnavailable:
|
||||||
|
continue
|
||||||
|
|
||||||
if not only_new or new:
|
if not only_new or new:
|
||||||
yield Message(thread.id,
|
yield Message(thread.id,
|
||||||
0,
|
0,
|
||||||
|
|
@ -104,8 +108,11 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||||
comment.body,
|
comment.body,
|
||||||
'Score: %d' % comment.score,
|
'Score: %d' % comment.score,
|
||||||
is_html=True)
|
is_html=True)
|
||||||
self.storage.set('seen', what, seen)
|
# If there is no articles seen, it's suspicious, probably I can't
|
||||||
self.storage.save()
|
# fetch the feed.
|
||||||
|
if seen:
|
||||||
|
self.storage.set('seen', what, seen)
|
||||||
|
self.storage.save()
|
||||||
|
|
||||||
def post_reply(self, thread_id, reply_id, title, message):
|
def post_reply(self, thread_id, reply_id, title, message):
|
||||||
return self.browser.post_reply(thread_id, reply_id, title, message)
|
return self.browser.post_reply(thread_id, reply_id, title, message)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue