Mercurial > hg > Feedworm
diff backend/AbstractFeedUpdater.py @ 206:f74fe7cb5091
when updating feeds, only ever create new Feed objects for entries that are younger than the current expire date. This ensures that we do not see old, read, expired entries again
author | dirk |
---|---|
date | Sat, 02 Jun 2012 04:30:04 +0200 |
parents | e604c32f67aa |
children | 524cbf9e413c |
line wrap: on
line diff
--- a/backend/AbstractFeedUpdater.py Sat Jun 02 04:24:49 2012 +0200 +++ b/backend/AbstractFeedUpdater.py Sat Jun 02 04:30:04 2012 +0200 @@ -1,8 +1,9 @@ from datetime import datetime +from urllib2 import ProxyHandler +import AbstractBackend import feedparser import logging -from urllib2 import ProxyHandler STATUS_ERROR = 400 log = logging.getLogger("FeedUpdater") @@ -42,7 +43,8 @@ def _processEntries(self, feedDict): for entry in feedDict.entries: self._normalize(entry) - self._processEntry(entry) + if not self._isExpired(entry): + self._processEntry(entry) self._incrementFeedUpdateDate() def _normalize(self, entry): @@ -74,6 +76,10 @@ else: entry.summary = "" + def _isExpired(self, entry): + expireDate = AbstractBackend.calculateExpireDate(self.preferences) + return entry.updated_parsed < expireDate + def _processEntry(self, entry): raise Exception("_processEntry is abstract, subclasses must override")