dbapi: try to restore compatibility of the connect api with 3.15
A few issues here:
- urlparse('foo').scheme is '', not None
- cnxprops is an optional argument
Regression from 62213a34726e ("[db-api/configuration] simplify db-api
and configuration so that all the connection information is in the
repository url, closes #2521848")
Closes #2754322
--- a/dbapi.py Wed Mar 20 17:40:25 2013 +0100
+++ b/dbapi.py Tue Mar 19 18:20:57 2013 +0100
@@ -204,13 +204,13 @@
there goes authentication tokens. You usually have to specify a password
for the given user, using a named 'password' argument.
"""
- if urlparse(database).scheme is None:
+ if not urlparse(database).scheme:
warn('[3.16] give an qualified URI as database instead of using '
'host/cnxprops to specify the connection method',
DeprecationWarning, stacklevel=2)
- if cnxprops.cnxtype == 'zmq':
+ if cnxprops and cnxprops.cnxtype == 'zmq':
database = kwargs.pop('host')
- elif cnxprops.cnxtype == 'inmemory':
+ elif cnxprops and cnxprops.cnxtype == 'inmemory':
database = 'inmemory://' + database
else:
database = 'pyro://%s/%s.%s' % (kwargs.pop('host', ''),