Mercurial > hg > Feedworm
comparison backend/AbstractBackend.py @ 206:f74fe7cb5091
when updating feeds, only ever create new Feed objects for entries that are younger than the current expire date. This ensures that we do not see old, read, expired entries again
author | dirk |
---|---|
date | Sat, 02 Jun 2012 04:30:04 +0200 |
parents | 3bcf39181f6e |
children | bb3c851b18b1 |
comparison
equal
deleted
inserted
replaced
205:adf7f617bda9 | 206:f74fe7cb5091 |
---|---|
1 | 1 |
2 from datetime import datetime, timedelta | 2 from datetime import datetime, timedelta |
3 | |
4 def calculateExpireDate(preferences): | |
5 now = datetime.now() | |
6 daysToKeepFeedEntries = preferences.daysToKeepFeedEntries() | |
7 delta = timedelta(days=daysToKeepFeedEntries) | |
8 return now - delta | |
3 | 9 |
4 class AbstractBackend(object): | 10 class AbstractBackend(object): |
5 def __init__(self): | 11 def __init__(self): |
6 self.feeds = [] | 12 self.feeds = [] |
7 self.selectedFeed = None | 13 self.selectedFeed = None |
25 hideReadEntries = self.preferences().hideReadFeedEntries() | 31 hideReadEntries = self.preferences().hideReadFeedEntries() |
26 self.feedEntries = self._retrieveEntriesForSelectedFeed(hideReadEntries) | 32 self.feedEntries = self._retrieveEntriesForSelectedFeed(hideReadEntries) |
27 return self.feedEntries | 33 return self.feedEntries |
28 | 34 |
29 def _calculateExpireDate(self): | 35 def _calculateExpireDate(self): |
30 now = datetime.now() | 36 return calculateExpireDate(self.preferences()) |
31 daysToKeepFeedEntries = self.preferences().daysToKeepFeedEntries() | |
32 delta = timedelta(days=daysToKeepFeedEntries) | |
33 return now - delta | |
34 | 37 |
35 # | 38 # |
36 # handling of the selected feed entry | 39 # handling of the selected feed entry |
37 # | 40 # |
38 | 41 |