Skip to content

Commit

Permalink
Hard-code provider name in connector, so existing test is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
strk committed Jan 9, 2020
1 parent 6aa87fa commit 67ce48f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -161,7 +161,7 @@ def close(self):

class PostGisDBConnector(DBConnector):

def __init__(self, uri, dbplugin):
def __init__(self, uri):
"""Creates a new PostgreSQL connector
:param uri: data source URI
Expand All @@ -178,11 +178,8 @@ def __init__(self, uri, dbplugin):
#self.passwd = uri.password()
self.host = uri.host()

self.dbplugin = dbplugin
md = QgsProviderRegistry.instance().providerMetadata(dbplugin.providerName())
self.core_connection = md.findConnection(dbplugin.connectionName())
if self.core_connection is None:
self.core_connection = md.createConnection(dbplugin.connectionName(), uri.database())
md = QgsProviderRegistry.instance().providerMetadata('postgres')
self.core_connection = md.createConnection(uri.database())

c = self._execute(None, u"SELECT current_user,current_database()")
self.user, self.dbname = self._fetchone(c)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/postgis/plugin.py
Expand Up @@ -112,7 +112,7 @@ def __init__(self, connection, uri):
Database.__init__(self, connection, uri)

def connectorsFactory(self, uri):
return PostGisDBConnector(uri, self.connection())
return PostGisDBConnector(uri)

def dataTablesFactory(self, row, db, schema=None):
return PGTable(row, db, schema)
Expand Down

0 comments on commit 67ce48f

Please sign in to comment.