dbapi.py
branchstable
changeset 7004 9e142116d82f
parent 6613 e7ff604491b2
child 7006 d0f635d3a6bb
child 7056 51f88f13d6f3
--- 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