dbapi.py
changeset 167 b726c12af78f
parent 0 b97547f5f1fa
child 169 0e031b66cb0b
--- a/dbapi.py	Tue Dec 02 16:26:52 2008 +0100
+++ b/dbapi.py	Fri Dec 05 17:24:48 2008 +0100
@@ -45,20 +45,20 @@
         from Pyro import core, naming, config as pyroconfig
         from Pyro.errors import NamingError, ProtocolError
         core.initClient(banner=0)
-        pyroconfig.PYRO_NS_DEFAULTGROUP = ':' + config['pyro-ns-group']
+        nsid = ':%s.%s' % (config['pyro-ns-group'], database)
         locator = naming.NameServerLocator()
         # resolve the Pyro object
         try:
             nshost, nsport = config['pyro-ns-host'], config['pyro-ns-port']
-            uri = locator.getNS(nshost, nsport).resolve(database)
+            uri = locator.getNS(nshost, nsport) .resolve(nsid)
         except ProtocolError:
             raise ConnectionError('Could not connect to the Pyro name server '
                                   '(host: %s:%i)' % (nshost, nsport))
-        except NamingError:
+        except NamingError, ex:
             raise ConnectionError('Could not get repository for %s '
-                                  '(not registered in Pyro),'
+                                  '(not registered in Pyro), '
                                   'you may have to restart your server-side '
-                                  'application' % database)
+                                  'application' % nsid)
         return core.getProxyForURI(uri)
         
 def repo_connect(repo, user, password, cnxprops=None):