comparison util.py @ 35:aaec263f07ca

Feeds manage the point in time when the next update should happen. FeedUpdater only updates feeds that are due.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 05 May 2010 03:07:59 +0200
parents 5813e3c10f14
children 22214d79ed41
comparison
equal deleted inserted replaced
34:5813e3c10f14 35:aaec263f07ca
1 1
2 from ConfigParser import ConfigParser 2 from ConfigParser import ConfigParser
3 from datetime import datetime, timedelta
3 from Feed import Feed 4 from Feed import Feed
4 import logging 5 import logging
5 import socket 6 import socket
6 7
7 logger = logging.getLogger("database") 8 logger = logging.getLogger("database")
28 rss_url = rss_url.rstrip() 29 rss_url = rss_url.rstrip()
29 feed = Feed(title, rss_url) 30 feed = Feed(title, rss_url)
30 session.add(feed) 31 session.add(feed)
31 file.close() 32 file.close()
32 session.commit() 33 session.commit()
34
35 def forceUpdateAllFeeds(session=None):
36 for feed in Feed.all(session):
37 feed.next_update = datetime.now() - timedelta(minutes=1)
38 session.commit()