summaryrefslogtreecommitdiff
path: root/python/skytools/scripting.py
diff options
context:
space:
mode:
authorMarko Kreen2007-12-05 15:41:16 +0000
committerMarko Kreen2007-12-05 15:41:16 +0000
commit4f150b6395dbb439ca98d3aee2301cc1f4d676d7 (patch)
tree78e36aaf2c213a816e5042bc834b814f9bf4cea2 /python/skytools/scripting.py
parent39e85838be8ff8296a4a13354d5144ae16539dc8 (diff)
DBScript: allow to specify exact connstr to get_database()
Diffstat (limited to 'python/skytools/scripting.py')
-rw-r--r--python/skytools/scripting.py7
1 files changed, 5 insertions, 2 deletions
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