view backend/couchdb/CouchDbBackend.py @ 144:74217db92993

updating feeds on the couchdb backend works now
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 24 Aug 2011 11:54:06 +0200
parents 2cd30af937fa
children 8ec20377bcb0
line wrap: on
line source


from FeedUpdater import FeedUpdater
from Preferences import Preferences
from backend.couchdb.Feed import Feed
import couchdb


DATABASE = "feedtest"

class CouchDbBackend(object):
    '''
    Backend that uses CouchDB for persistence
    '''

    def __init__(self):
        server = couchdb.Server()
        self.database = server[DATABASE]

    def preferences(self):
        return Preferences(self.database)

    def getFeeds(self):
        raise Exception("not yet implemented")

    def toggleRead(self, feedEntry):
        raise Exception("not yet implemented")

    def markAllEntriesRead(self, feed):
        raise Exception("not yet implemented")

    def createFeed(self, url):
        raise Exception("not yet implemented")

    def updateFeed(self, feed, changes):
        raise Exception("not yet implemented")

    def deleteFeed(self, feed):
        raise Exception("not yet implemented")

    def markFeedEntriesAsRead(self, entries):
        raise Exception("not yet implemented")

    def updateAllFeeds(self):
        # TODO use a view instead of iterating all feeds
        allFeeds = Feed.all(self.database)
        for feed in allFeeds:
            if feed.needsUpdate():
                FeedUpdater(feed, self.database).update()

    def expireFeedEntries(self):
        print("Expiring feeds is not yet implemented")
#        raise Exception("not yet implemented")

    def dispose(self):
        # nothing to do here
        pass