changeset 173:3bcf39181f6e

pull the calculation of the epxire date up into AbstractBackend
author dirk
date Fri, 09 Sep 2011 17:19:16 +0200
parents 214addba1f93
children d0ced79b5030
files backend/AbstractBackend.py backend/sqlalchemy/SqlAlchemyBackend.py
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/backend/AbstractBackend.py	Fri Sep 09 17:17:39 2011 +0200
+++ b/backend/AbstractBackend.py	Fri Sep 09 17:19:16 2011 +0200
@@ -1,3 +1,5 @@
+
+from datetime import datetime, timedelta
 
 class AbstractBackend(object):
     def __init__(self):
@@ -24,6 +26,12 @@
             self.feedEntries = self._retrieveEntriesForSelectedFeed(hideReadEntries)
         return self.feedEntries
 
+    def _calculateExpireDate(self):
+        now = datetime.now()
+        daysToKeepFeedEntries = self.preferences().daysToKeepFeedEntries()
+        delta = timedelta(days=daysToKeepFeedEntries)
+        return now - delta
+
     #
     # handling of the selected feed entry
     #
--- a/backend/sqlalchemy/SqlAlchemyBackend.py	Fri Sep 09 17:17:39 2011 +0200
+++ b/backend/sqlalchemy/SqlAlchemyBackend.py	Fri Sep 09 17:19:16 2011 +0200
@@ -4,7 +4,6 @@
 from FeedUpdater import FeedUpdater
 from Preferences import Preferences
 from backend.AbstractBackend import AbstractBackend
-from datetime import datetime, timedelta
 from sqlalchemy.orm import joinedload
 from sqlalchemy.sql import and_
 import Database
@@ -119,9 +118,3 @@
         )
         deleteStatement.execute()
         self.session.commit()
-
-    def _calculateExpireDate(self):
-        now = datetime.now()
-        daysToKeepFeedEntries = self.prefs.daysToKeepFeedEntries()
-        delta = timedelta(days=daysToKeepFeedEntries)
-        return now - delta