Mercurial > hg > Feedworm
comparison feedupdate-main.py @ 11:e87c54b3a216
use the logging framework for printing messages
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 27 Apr 2010 20:18:22 +0200 |
parents | 87317ba41816 |
children | 9ede118b93ef |
comparison
equal
deleted
inserted
replaced
10:01a86b178e60 | 11:e87c54b3a216 |
---|---|
2 | 2 |
3 from ConfigParser import ConfigParser | 3 from ConfigParser import ConfigParser |
4 from Feed import Feed | 4 from Feed import Feed |
5 from FeedUpdater import updateAllFeeds | 5 from FeedUpdater import updateAllFeeds |
6 import Mapping | 6 import Mapping |
7 import logging | |
7 import socket | 8 import socket |
8 from sqlalchemy import create_engine | 9 from sqlalchemy import create_engine |
9 from sqlalchemy.orm import sessionmaker | 10 from sqlalchemy.orm import sessionmaker |
11 | |
12 logger = logging.getLogger("feedupdater") | |
10 | 13 |
11 def loadDatabaseProperties(): | 14 def loadDatabaseProperties(): |
12 hostname = socket.gethostname() | 15 hostname = socket.gethostname() |
13 filename = "database-%s.ini" % hostname | 16 filename = "database-%s.ini" % hostname |
14 | 17 |
23 session.commit() | 26 session.commit() |
24 | 27 |
25 def listFeeds(session): | 28 def listFeeds(session): |
26 allFeeds = session.query(Feed) | 29 allFeeds = session.query(Feed) |
27 for feed in allFeeds: | 30 for feed in allFeeds: |
28 print "\n\nfeed: " + feed.name | 31 logger.info("feed: " + feed.name) |
29 for entry in feed.entries: | 32 for entry in feed.entries: |
30 print entry.title | 33 print entry.title |
31 | 34 |
32 if __name__ == "__main__": | 35 if __name__ == "__main__": |
33 databaseUrl = loadDatabaseProperties() | 36 databaseUrl = loadDatabaseProperties() |