Mercurial > hg > Feedworm
view feedupdate-main.py @ 3:2ac144a98370
add the .hgignore file to ignore .pyc files
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 26 Apr 2010 17:43:48 +0200 |
parents | 8a624ee48a74 |
children | e0199f383442 |
line wrap: on
line source
#!/usr/bin/env python from ConfigParser import ConfigParser from Feed import Feed import Mapping import socket from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker def loadDatabaseProperties(): hostname = socket.gethostname() filename = "database-%s.ini" % hostname parser = ConfigParser(); parser.read(filename) return parser.get("database", "url") def createFeed(session): newFeed = Feed("Joel on Software", "http://www.joelonsoftware.com/rss.xml") session.add(newFeed) session.commit() if __name__ == "__main__": databaseUrl = loadDatabaseProperties() engine = create_engine(databaseUrl,echo=True) Mapping.createMapping(engine) SessionMaker = sessionmaker(bind = engine) session = SessionMaker() createFeed(session)