Mercurial > hg > Feedworm
comparison Feed.py @ 31:5bb57caa8f66
display a feed's entries sorted by their update date
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 30 Apr 2010 06:01:54 +0200 |
parents | 5fda8bd94fa8 |
children | aaec263f07ca |
comparison
equal
deleted
inserted
replaced
30:ee1432a91141 | 31:5bb57caa8f66 |
---|---|
1 | |
2 import FeedEntry | |
1 | 3 |
2 class Feed(object): | 4 class Feed(object): |
3 @staticmethod | 5 @staticmethod |
4 def all(session): | 6 def all(session): |
5 return session.query(Feed).order_by(Feed.title).all() | 7 return session.query(Feed).order_by(Feed.title).all() |
11 def __repr__(self): | 13 def __repr__(self): |
12 return "<Feed (%d) %s>" % (self.pk, self.title) | 14 return "<Feed (%d) %s>" % (self.pk, self.title) |
13 | 15 |
14 def userPresentableString(self): | 16 def userPresentableString(self): |
15 return self.title | 17 return self.title |
18 | |
19 def entriesSortedByUpdateDate(self): | |
20 sortedEntries = list(self.entries) | |
21 sortedEntries.sort(FeedEntry.compareByUpdateDate) | |
22 return sortedEntries |