Mercurial > hg > Feedworm
comparison util.py @ 37:22214d79ed41
database URL must be given as commandline argument now, no need for creating complicated config files. Add a menu entry for opening the selected article in browser.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 14 May 2010 06:16:05 +0200 |
parents | aaec263f07ca |
children | 12ed8b5fa08c |
comparison
equal
deleted
inserted
replaced
36:74b8c9a9d5de | 37:22214d79ed41 |
---|---|
1 | 1 |
2 from ConfigParser import ConfigParser | |
3 from datetime import datetime, timedelta | 2 from datetime import datetime, timedelta |
4 from Feed import Feed | 3 from Feed import Feed |
5 import logging | 4 import logging |
6 import socket | |
7 | 5 |
8 logger = logging.getLogger("database") | 6 logger = logging.getLogger("database") |
9 | 7 |
10 def configureLogging(): | 8 def configureLogging(): |
11 logging.basicConfig(level=logging.DEBUG) | 9 logging.basicConfig(level=logging.DEBUG) |
12 logging.getLogger("sqlalchemy").setLevel(logging.INFO) | 10 logging.getLogger("sqlalchemy").setLevel(logging.INFO) |
13 logging.getLogger("sqlalchemy.orm").setLevel(logging.WARN) | 11 logging.getLogger("sqlalchemy.orm").setLevel(logging.WARN) |
14 | |
15 def loadDatabaseUrl(): | |
16 hostname = socket.gethostname() | |
17 filename = "database-%s.ini" % hostname | |
18 logger.debug("loading database configuration from " + filename) | |
19 | |
20 parser = ConfigParser(); | |
21 parser.read(filename) | |
22 return parser.get("database", "url") | |
23 | 12 |
24 def loadFeeds(session=None, filename="feeds.txt"): | 13 def loadFeeds(session=None, filename="feeds.txt"): |
25 file = open(filename) | 14 file = open(filename) |
26 for line in file: | 15 for line in file: |
27 (title, rss_url) = line.split("|") | 16 (title, rss_url) = line.split("|") |