# HG changeset patch # User Julien Cristau # Date 1363713657 -3600 # Node ID 2091d275fe5c93ca02ad067eb5000a594ebb45a0 # Parent 27a83746aebd6cbcfb25c97feec952ee1e666cd1 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 diff -r 27a83746aebd -r 2091d275fe5c dbapi.py --- 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', ''),