diff --git a/gramps/plugins/db/dbapi/settings.py b/gramps/plugins/db/dbapi/settings.py index a9b2c645d..5e5f2e137 100644 --- a/gramps/plugins/db/dbapi/settings.py +++ b/gramps/plugins/db/dbapi/settings.py @@ -38,15 +38,15 @@ if dbtype == "sqlite": dbapi = Sqlite(path_to_db) else: # NOTE: you can override these settings here or in settings.ini: - dbname = config.get('database.dbname') - host = config.get('database.host') - user = config.get('database.user') - password = config.get('database.password') - port = config.get('database.port') + dbkwargs = {} + for key in config.get_section_settings('database'): + # Use all parameters except dbtype as keyword arguments + if key == 'dbtype': + continue + dbkwargs[key] = config.get('database.' + key) if dbtype == "postgresql": from gramps.plugins.db.dbapi.postgresql import Postgresql - dbapi = Postgresql(dbname=dbname, user=user, - host=host, password=password) + dbapi = Postgresql(**dbkwargs) else: raise AttributeError(("invalid DB-API dbtype: '%s'. " + "Should be 'sqlite' or 'postgresql'") % dbtype)