Don't get page with 0 comment

This commit is contained in:
Florent 2012-03-20 14:38:49 +01:00 committed by Florent Fourcot
commit 56a5eca576
2 changed files with 6 additions and 3 deletions

View file

@ -108,7 +108,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent):
# Check if we have seen all comments of this thread.
oldhash = self.storage.get('hash', id, default="")
newhash = self.browser.get_hash(thread._rsscomment)
if not getseen and oldhash == newhash:
if not getseen and (oldhash == newhash or newhash is None):
return None
self.storage.set('hash', id, newhash)
if thread.date:

View file

@ -133,8 +133,11 @@ class DLFP(BaseBrowser):
def get_hash(self, url):
self.location(url)
myhash = hashlib.md5(lxml.etree.tostring(self.page.document)).hexdigest()
return myhash
if self.page.document.xpath('//entry'):
myhash = hashlib.md5(lxml.etree.tostring(self.page.document)).hexdigest()
return myhash
else:
return None
def get_content(self, _id):
url, _id = self.parse_id(_id)