projects
/
skytools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
39e8583
)
DBScript: allow to specify exact connstr to get_database()
author
Marko Kreen
<markokr@gmail.com>
Wed, 5 Dec 2007 15:41:16 +0000
(15:41 +0000)
committer
Marko Kreen
<markokr@gmail.com>
Wed, 5 Dec 2007 15:41:16 +0000
(15:41 +0000)
python/skytools/scripting.py
patch
|
blob
|
blame
|
history
diff --git
a/python/skytools/scripting.py
b/python/skytools/scripting.py
index 71cf3f891e9edd12c1ad1cacea0e958e0e455e88..08412926b2560d3dfb973ed7740dbca77f3a687d 100644
(file)
--- 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