Skip to content

Commit

Permalink
[db_manager] Fix connection to postgis
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-morvan committed Nov 6, 2016
1 parent 8b8bc26 commit 9cd39e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, uri):

expandedConnInfo = self._connectionInfo()
try:
self.connection = psycopg2.connect(expandedConnInfo.encode('utf-8'))
self.connection = psycopg2.connect(expandedConnInfo)
except self.connection_error_types() as e:
err = str(e)
uri = self.uri()
Expand All @@ -83,7 +83,7 @@ def __init__(self, uri):

newExpandedConnInfo = uri.connectionInfo(True)
try:
self.connection = psycopg2.connect(newExpandedConnInfo.encode('utf-8'))
self.connection = psycopg2.connect(newExpandedConnInfo)
QgsCredentials.instance().put(conninfo, username, password)
except self.connection_error_types() as e:
if i == 2:
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/db_manager/db_plugins/postgis/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def connect(self, parent=None):

settings.endGroup()

if hasattr(authcfg, 'isNull') and authcfg.isNull():
authcfg = ''

if service:
uri.setConnection(service, database, username, password, sslmode, authcfg)
else:
Expand Down

0 comments on commit 9cd39e7

Please sign in to comment.