comparison backend/couchdb/FeedEntry.py @ 169:91a24f499318

introdue an abstraction for the name of the database so it can be changed via commandline parameter
author dirk
date Fri, 09 Sep 2011 14:52:54 +0200
parents e284a37df1d9
children 27be2a5f9c10
comparison
equal deleted inserted replaced
168:f4708d38419c 169:91a24f499318
1 1
2 from couchdb.mapping import BooleanField, DateTimeField, Document, TextField 2 from couchdb.mapping import BooleanField, DateTimeField, Document, TextField
3 from datetime import datetime 3 from datetime import datetime
4 import CouchDb
4 5
5 class FeedEntry(Document): 6 class FeedEntry(Document):
6 doctype = TextField(default="feedEntry") 7 doctype = TextField(default="feedEntry")
7 create_timestamp = DateTimeField(default=datetime.now()) 8 create_timestamp = DateTimeField(default=datetime.now())
8 read = BooleanField(default=False) 9 read = BooleanField(default=False)
12 updated = DateTimeField() 13 updated = DateTimeField()
13 feed = TextField() 14 feed = TextField()
14 15
15 @staticmethod 16 @staticmethod
16 def findByLink(link, database): 17 def findByLink(link, database):
17 result = FeedEntry.view(database, "feedtest/feedEntry_by_link", key=link) 18 result = FeedEntry.view(database, CouchDb.feedEntryByLink(), key=link)
18 try: 19 try:
19 return iter(result).next() 20 return iter(result).next()
20 except StopIteration: 21 except StopIteration:
21 return None 22 return None
22 23