view backend/couchdb/Preferences.py @ 148:c5a427d46703

displaying entries for a feed works now with the couchdb backend
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 26 Aug 2011 06:13:39 +0200
parents 8ec20377bcb0
children 2d159eb2a91b
line wrap: on
line source


class Preferences(object):
    def __init__(self, database):
        self.database = database
        self.viewResults = self.database.view("feedtest/preference_by_key")

    def _valueForKey(self, key):
        try:
            resultsForKey = self.viewResults[key]
            row = iter(resultsForKey).next()
            return row.value["value"]
        except StopIteration:
            return None

    def isProxyConfigured(self):
        return self.proxyHost() is not None

    def proxyHost(self):
        return self._valueForKey("proxyHost")

    def proxyPort(self):
        return self._valueForKey("proxyPort")

    def showOnlyUnreadFeeds(self):
        return self._valueForKey("showOnlyUnreadFeeds")

    def startMaximized(self):
        return self._valueForKey("startMaximized")

    def hideReadFeedEntries(self):
        return self._valueForKey("hideReadFeedEntries")