From 4f150b6395dbb439ca98d3aee2301cc1f4d676d7 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 5 Dec 2007 15:41:16 +0000 Subject: DBScript: allow to specify exact connstr to get_database() --- python/skytools/scripting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/skytools/scripting.py') diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index 71cf3f89..08412926 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -397,7 +397,7 @@ class DBScript(object): self.stat_dict = {} def get_database(self, dbname, autocommit = 0, isolation_level = -1, - cache = None): + cache = None, connstr = None): """Load cached database connection. User must not store it permanently somewhere, @@ -410,7 +410,10 @@ class DBScript(object): if cache in self.db_cache: dbc = self.db_cache[cache] else: - loc = self.cf.get(dbname) + if connstr: + loc = connstr + else: + loc = self.cf.get(dbname) dbc = DBCachedConn(cache, loc, max_age) self.db_cache[cache] = dbc -- cgit v1.2.3