view backend/couchdb/FeedEntry.py @ 145:71c5dc02ff87

move the code from FeedList into the backend class
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 25 Aug 2011 05:39:03 +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]