Mercurial > hg > Feedworm
diff backend/couchdb/FeedEntry.py @ 189:e5d492595bdb
the view returns feed entries for a feed sorted by update date now, no need to do sorting in-memory
author | dirk |
---|---|
date | Wed, 14 Sep 2011 00:17:55 +0200 |
parents | ac1de0a467fd |
children | 9d422fa90096 |
line wrap: on
line diff
--- a/backend/couchdb/FeedEntry.py Wed Sep 14 00:17:01 2011 +0200 +++ b/backend/couchdb/FeedEntry.py Wed Sep 14 00:17:55 2011 +0200 @@ -1,6 +1,6 @@ from backend.couchdb.ListDateTimeField import ListDateTimeField -from couchdb.mapping import BooleanField, DateTimeField, Document, TextField +from couchdb.mapping import BooleanField, Document, TextField from datetime import datetime import CouchDb @@ -11,7 +11,7 @@ link = TextField() title = TextField() summary = TextField() - updated = DateTimeField() + updated = ListDateTimeField() feed = TextField() @staticmethod @@ -29,12 +29,10 @@ return FeedEntry.view(database, CouchDb.readFeedEntriesByCreateDate(), endkey=end) @staticmethod - def compareByUpdateDate(first, second): - return cmp(first, second) - - @staticmethod def entriesForFeed(feed, database): - viewResults = FeedEntry.view(database, CouchDb.feedEntriesByFeed(), key=feed.id) + ''' the definition of the view makes sure that the entries come out sorted by udpate date ''' + viewResults = FeedEntry.view(database, CouchDb.feedEntriesByFeed(), startkey=[feed.id], + endkey=[feed.id, {}]) return list(viewResults) def markRead(self, database): @@ -47,4 +45,3 @@ else: self.read = True self.store(database) -