diff roundup/backends/rdbms_common.py @ 2634:f47ca4541770

Both RDBMS backends now use the same config.ini section, [rdbms]. Comments on each option clearly state that the options only apply to postgresql or mysql.
author Richard Jones <richard@users.sourceforge.net>
date Tue, 27 Jul 2004 01:18:25 +0000
parents c86b2179085b
children b01eca163779
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Tue Jul 27 00:57:19 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Tue Jul 27 01:18:25 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.124 2004-07-20 05:58:07 richard Exp $
+# $Id: rdbms_common.py,v 1.125 2004-07-27 01:18:25 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -59,6 +59,18 @@
     # assume it's a number returned from the db API
     return int(value)
 
+def connection_dict(config, dbnamestr=None):
+    ''' Used by Postgresql and MySQL to detemine the keyword args for
+    opening the database connection.'''
+    d = { }
+    if dbnamestr:
+        d[dbnamestr] = config.RDBMS_NAME
+    for name in 'host', 'port', 'password', 'user':
+        cvar = 'RDBMS_'+name.upper()
+        if config[cvar] is not None:
+            d[name] = config[cvar]
+    return d
+
 class Database(FileStorage, hyperdb.Database, roundupdb.Database):
     ''' Wrapper around an SQL database that presents a hyperdb interface.
 

Roundup Issue Tracker: http://roundup-tracker.org/