Mercurial > hg > Feedworm
comparison Feed.py @ 61:db35ab7753f0
add a preference to hide read feed entries
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 24 Jul 2010 03:11:06 +0200 |
parents | daa2731967fe |
children | d292ab61ed6f |
comparison
equal
deleted
inserted
replaced
60:d063e4814357 | 61:db35ab7753f0 |
---|---|
19 return "<Feed (%d) %s>" % (self.pk, self.title) | 19 return "<Feed (%d) %s>" % (self.pk, self.title) |
20 | 20 |
21 def userPresentableString(self): | 21 def userPresentableString(self): |
22 return self.title | 22 return self.title |
23 | 23 |
24 def entriesSortedByUpdateDate(self): | 24 def entriesSortedByUpdateDate(self, hideReadEntries=False): |
25 sortedEntries = list(self.entries) | 25 sortedEntries = list(self.entries) |
26 sortedEntries.sort(FeedEntry.compareByUpdateDate) | 26 sortedEntries.sort(FeedEntry.compareByUpdateDate) |
27 if hideReadEntries: | |
28 return self._filterReadEntries(sortedEntries) | |
27 return sortedEntries | 29 return sortedEntries |
30 | |
31 def _filterReadEntries(self, entries): | |
32 retValue = [] | |
33 for entry in entries: | |
34 if not entry.read: | |
35 retValue.append(entry) | |
36 return retValue | |
28 | 37 |
29 def incrementNextUpdateDate(self): | 38 def incrementNextUpdateDate(self): |
30 delta = timedelta(minutes=self.update_interval) | 39 delta = timedelta(minutes=self.update_interval) |
31 self.next_update = datetime.now() + delta | 40 self.next_update = datetime.now() + delta |
32 | 41 |