changeset 258:4ca1fac32dde

Pull the constant of days to keep feed entries into the abstract class
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 12 Mar 2019 02:39:18 +0100
parents 75b81da8d7a5
children 304917762618
files backend/AbstractPreferences.py backend/arangodb/Preferences.py backend/couchdb/Preferences.py
diffstat 3 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/backend/AbstractPreferences.py	Tue Mar 12 02:38:41 2019 +0100
+++ b/backend/AbstractPreferences.py	Tue Mar 12 02:39:18 2019 +0100
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 class AbstractPreferences(object):
+    DAYS_TO_KEEP_FEED_ENTRIES = "daysToKeepFeedEntries"
     HIDE_READ_FEED_ENTRIES = "hideReadFeedEntries"
     PROXY_HOST = "proxyHost"
     SHOW_ONLY_UNREAD_FEEDS = "showOnlyUnreadFeeds"
--- a/backend/arangodb/Preferences.py	Tue Mar 12 02:38:41 2019 +0100
+++ b/backend/arangodb/Preferences.py	Tue Mar 12 02:39:18 2019 +0100
@@ -8,6 +8,9 @@
         collection = database.get_or_create_collection('preferences')
         self.doc = collection.fetchAll(limit=1)[0]
 
+    def daysToKeepFeedEntries(self):
+        return int(self.doc[self.DAYS_TO_KEEP_FEED_ENTRIES])
+
     def hideReadFeedEntries(self):
         return self.doc[self.HIDE_READ_FEED_ENTRIES]
 
--- a/backend/couchdb/Preferences.py	Tue Mar 12 02:38:41 2019 +0100
+++ b/backend/couchdb/Preferences.py	Tue Mar 12 02:39:18 2019 +0100
@@ -2,7 +2,6 @@
 from ..AbstractPreferences import AbstractPreferences
 import CouchDb
 
-DAYS_TO_KEEP_FEED_ENTRIES = "daysToKeepFeedEntries"
 PROXY_PORT = "proxyPort"
 
 class Preferences(AbstractPreferences):
@@ -78,7 +77,7 @@
         self._setDocumentValue(self.HIDE_READ_FEED_ENTRIES, flag)
 
     def daysToKeepFeedEntries(self):
-        value = self._documentValue(DAYS_TO_KEEP_FEED_ENTRIES, 90)
+        value = self._documentValue(self.DAYS_TO_KEEP_FEED_ENTRIES, 90)
         return int(value)
 
     def setDaysToKeepFeedEntries(self, days):