Mercurial > hg > Feedworm
view backend/couchdb/FeedEntry.py @ 172:214addba1f93
always return an int value for daysToKeepFeedEntries
author | dirk |
---|---|
date | Fri, 09 Sep 2011 17:17:39 +0200 |
parents | 27be2a5f9c10 |
children | d0ced79b5030 |
line wrap: on
line source
from backend.couchdb.ListDateTimeField import ListDateTimeField from couchdb.mapping import BooleanField, DateTimeField, Document, TextField from datetime import datetime import CouchDb class FeedEntry(Document): doctype = TextField(default="feedEntry") create_timestamp = ListDateTimeField(default=datetime.now()) read = BooleanField(default=False) link = TextField() title = TextField() summary = TextField() updated = DateTimeField() feed = TextField() @staticmethod def findByLink(link, database): result = FeedEntry.view(database, CouchDb.feedEntryByLink(), key=link) try: return iter(result).next() except StopIteration: return None def markRead(self, database): self.read = True self.store(database) def toggleRead(self, database): if self.read: self.read = False else: self.read = True self.store(database)