Mercurial > hg > Feedworm
comparison Database.py @ 70:842727971796
have the DB URL as parameter when creating a session and fall back to commandline arguments if no DB URL was passed in
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 11 Aug 2010 02:30:47 +0200 |
parents | 254d5b89a6ca |
children |
comparison
equal
deleted
inserted
replaced
69:d20e99d46d78 | 70:842727971796 |
---|---|
8 # Keep the connection to the database only once. The feed updater and the GUI app will | 8 # Keep the connection to the database only once. The feed updater and the GUI app will |
9 # operate on a single engine/session but this comes in handy for interactive use | 9 # operate on a single engine/session but this comes in handy for interactive use |
10 engine = None | 10 engine = None |
11 SessionMaker = None | 11 SessionMaker = None |
12 | 12 |
13 def createSession(): | 13 def createSession(databaseUrl=None): |
14 databaseUrl = _getDatabaseUrl() | 14 if databaseUrl is None: |
15 databaseUrl = _getDatabaseUrl() | |
15 initEngine(databaseUrl) | 16 initEngine(databaseUrl) |
16 Mapping.createMapping(engine) | 17 Mapping.createMapping(engine) |
17 initSessionMaker() | 18 initSessionMaker() |
18 return SessionMaker() | 19 return SessionMaker() |
19 | 20 |