Mercurial > hg > Feedworm
view backend/couchdb/FeedEntry.py @ 147:b290e29a94b5
use couchdb's mapping API instead of manually coding around Rows - much leaner code :-)
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 25 Aug 2011 11:05:05 +0200 |
parents | 74217db92993 |
children | a05719a6175e |
line wrap: on
line source
from couchdb.mapping import BooleanField, DateTimeField, Document, TextField from datetime import datetime class FeedEntry(Document): doctype = TextField(default="feedEntry") create_timestamp = DateTimeField(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, "feedtest/feedEntry_by_link", { "key" : link }) # try: # row = iter(result).next() # return FeedEntry(row) # except StopIteration: # return None return None