diff backend/AbstractBackend.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 3bcf39181f6e
children bb3c851b18b1
line wrap: on
line diff
--- a/backend/AbstractBackend.py	Sat Jun 02 04:24:49 2012 +0200
+++ b/backend/AbstractBackend.py	Sat Jun 02 04:30:04 2012 +0200
@@ -1,6 +1,12 @@
 
 from datetime import datetime, timedelta
 
+def calculateExpireDate(preferences):
+        now = datetime.now()
+        daysToKeepFeedEntries = preferences.daysToKeepFeedEntries()
+        delta = timedelta(days=daysToKeepFeedEntries)
+        return now - delta
+
 class AbstractBackend(object):
     def __init__(self):
         self.feeds = []
@@ -27,10 +33,7 @@
         return self.feedEntries
 
     def _calculateExpireDate(self):
-        now = datetime.now()
-        daysToKeepFeedEntries = self.preferences().daysToKeepFeedEntries()
-        delta = timedelta(days=daysToKeepFeedEntries)
-        return now - delta
+        return calculateExpireDate(self.preferences())
 
     #
     # handling of the selected feed entry