view backend/couchdb/FeedEntry.py @ 146:8ec20377bcb0

move getting the entries for a feed to the backend so that the couchdb backend can use a custom view for feed entries
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 25 Aug 2011 07:01:45 +0200
parents 74217db92993
children b290e29a94b5
line wrap: on
line source


class FeedEntry(object):
    @staticmethod
    def findByLink(link, database):
        viewResults = database.view("feedtest/feedEntry_by_link")
        resultsForKey = viewResults[link]
        try:
            row = iter(resultsForKey).next()
            return FeedEntry(row)
        except StopIteration:
            return None

    def __init__(self, row):
        self.row = row

    def __getattr__(self, key):
        return self.row.value[key]