diff backend/couchdb/CouchDbBackend.py @ 174:d0ced79b5030

implement expiring read feed entries
author dirk
date Fri, 09 Sep 2011 17:21:34 +0200
parents 91a24f499318
children 57e324fa4350
line wrap: on
line diff
--- a/backend/couchdb/CouchDbBackend.py	Fri Sep 09 17:19:16 2011 +0200
+++ b/backend/couchdb/CouchDbBackend.py	Fri Sep 09 17:21:34 2011 +0200
@@ -2,10 +2,11 @@
 from FeedUpdater import FeedUpdater
 from Preferences import Preferences
 from backend.AbstractBackend import AbstractBackend
+from backend.couchdb import CouchDb
 from backend.couchdb.Feed import Feed
 from backend.couchdb.FeedEntry import FeedEntry
 import couchdb
-from backend.couchdb import CouchDb
+import logging
 
 class CouchDbBackend(AbstractBackend):
     '''
@@ -101,6 +102,8 @@
                 FeedUpdater(self.database, self.preferences()).update(feed)
 
     def expireFeedEntries(self):
-        print("Expiring feeds is not yet implemented")
-#        raise Exception("not yet implemented")
-
+        logger = logging.getLogger("expiry")
+        expireDate = self._calculateExpireDate()
+        logger.info("expiring entries older than " + str(expireDate))
+        for entry in FeedEntry.getReadFeedEntriesOlderThan(expireDate, self.database):
+            del self.database[entry.id]