Mercurial > hg > Feedworm
view util.py @ 33:f371d02fa09d
mark unread feed entries bold. Add a menu item to toggle between read/unread
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 30 Apr 2010 06:22:33 +0200 |
parents | 72dfae865899 |
children | 5813e3c10f14 |
line wrap: on
line source
from ConfigParser import ConfigParser import logging import Mapping import socket from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker logger = logging.getLogger("database") def configureLogging(): logging.basicConfig(level=logging.DEBUG) logging.getLogger("sqlalchemy").setLevel(logging.INFO) logging.getLogger("sqlalchemy.orm").setLevel(logging.WARN) def createSession(): databaseUrl = loadDatabaseUrl() engine = create_engine(databaseUrl,echo=False) Mapping.createMapping(engine) SessionMaker = sessionmaker(bind = engine) session = SessionMaker() return session def loadDatabaseUrl(): hostname = socket.gethostname() filename = "database-%s.ini" % hostname logger.debug("loading database configuration from " + filename) parser = ConfigParser(); parser.read(filename) return parser.get("database", "url")