view backend/couchdb/Preferences.py @ 138:2642c8d89bdc

added TODO item
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 24 Aug 2011 09:15:29 +0200
parents 9e1e6b96d8b0
children 8ec20377bcb0
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")