# HG changeset patch # User Sylvain Thénault # Date 1297955299 -3600 # Node ID 9e142116d82f8e4d92a30dc0398b34e2d955bc4b # Parent 6eeed1e9782c8f06de22ff416b47b08f9bd70575 [dbapi] fix for cases where one want to use 'connect' for an in-memory connection diff -r 6eeed1e9782c -r 9e142116d82f dbapi.py --- a/dbapi.py Thu Feb 17 16:08:09 2011 +0100 +++ b/dbapi.py Thu Feb 17 16:08:19 2011 +0100 @@ -168,16 +168,20 @@ where it's already initialized. :kwargs: - there goes authentication tokens. You usually have to specify for - instance a password for the given user, using a named 'password' argument. + there goes authentication tokens. You usually have to specify a password + for the given user, using a named 'password' argument. """ - config = cwconfig.CubicWebNoAppConfiguration() - if host: - config.global_set_option('pyro-ns-host', host) - if group: - config.global_set_option('pyro-ns-group', group) cnxprops = cnxprops or ConnectionProperties() method = cnxprops.cnxtype + if method == 'pyro': + config = cwconfig.CubicWebNoAppConfiguration() + if host: + config.global_set_option('pyro-ns-host', host) + if group: + config.global_set_option('pyro-ns-group', group) + else: + assert database + config = cwconfig.instance_configuration(database) repo = get_repository(method, database, config=config) if method == 'inmemory': vreg = repo.vreg