Skip to content
Permalink
Browse files

Merge pull request #3635 from arnaud-morvan/processing_postgis_connect

[processing][db_manager] Fix connection to postgis
  • Loading branch information
rouault committed Nov 13, 2016
2 parents dbf6107 + 9cd39e7 commit 8b1adc5dcd5a9aae519ed891ddd241ee6f064600
@@ -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()
@@ -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:
@@ -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:
@@ -59,6 +59,9 @@ def uri_from_name(conn_name):

settings.endGroup()

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

if service:
uri.setConnection(service, database, username, password, sslmode, authcfg)
else:
@@ -202,7 +205,7 @@ def __init__(self, host=None, port=None, dbname=None, user=None,
for i in range(4):
expandedConnInfo = self.uri.connectionInfo(True)
try:
self.con = psycopg2.connect(expandedConnInfo.encode('utf-8'))
self.con = psycopg2.connect(expandedConnInfo)
if err is not None:
QgsCredentials.instance().put(conninfo,
self.uri.username(),

0 comments on commit 8b1adc5

Please sign in to comment.
You can’t perform that action at this time.