Mercurial > hg > Feedworm
view Feed.py @ 39:0c2578196643
Disable the article menu by default, enable it when the first article is selected
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 14 May 2010 06:48:48 +0200 |
parents | aaec263f07ca |
children | a8442c3487b5 |
line wrap: on
line source
from datetime import datetime, timedelta import FeedEntry class Feed(object): @staticmethod def all(session): return session.query(Feed).order_by(Feed.title).all() def __init__(self, title, rss_url): self.title = title self.rss_url = rss_url # default: update every 60 minutes self.update_interval = 60 self.incrementNextUpdateDate() def __repr__(self): return "<Feed (%d) %s>" % (self.pk, self.title) def userPresentableString(self): return self.title def entriesSortedByUpdateDate(self): sortedEntries = list(self.entries) sortedEntries.sort(FeedEntry.compareByUpdateDate) return sortedEntries def incrementNextUpdateDate(self): delta = timedelta(minutes=self.update_interval) self.next_update = datetime.now() + delta