Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processing][db_manager] Fix connection to postgis #3635

Merged
merged 2 commits into from
Nov 13, 2016

Conversation

arnaud-morvan
Copy link
Contributor

Fix some postgis connection errors, probably due to Python3.

@arnaud-morvan arnaud-morvan changed the title [processing][db_manager] Fix connection to postgis [WIP][processing][db_manager] Fix connection to postgis Oct 19, 2016
@rouault
Copy link
Contributor

rouault commented Oct 29, 2016

Is it still a work in progress ?

@arnaud-morvan
Copy link
Contributor Author

I've put WIP on this, because I was surprised no one have raised or fixed this since master use QT5 / Python3. I've not sure about the source of the error, why we get null variants here, and I've not got the time to search more deeply on this subject.
Do someone else get the same problem ? If right, I think we could merge to fix it.

@arnaud-morvan arnaud-morvan changed the title [WIP][processing][db_manager] Fix connection to postgis [processing][db_manager] Fix connection to postgis Nov 6, 2016
@arnaud-morvan
Copy link
Contributor Author

Seems really needed, can some one take a look and merge.

@@ -59,6 +59,9 @@ def uri_from_name(conn_name):

settings.endGroup()

if hasattr(authcfg, 'isNull') and authcfg.isNull():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part looks a bit awkward to me
Why is the hasattr(authcfg, 'isNull') needed ? Are there case where authcfg wouldn't be a QString ?
And then why transforming a null QString into an empty QString ?
Shouldn't rather setConnection() be made robust to support null strings in addition to empty strings.

Copy link
Contributor Author

@arnaud-morvan arnaud-morvan Nov 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that QSettings do not return a NULL QString, but a NULL QVariant :

arguments did not match any overloaded call:

QgsDataSourceUri.setConnection(str, str, str, str, str, QgsDataSourceUri.SslMode sslmode=QgsDataSourceUri.SslPrefer, str authConfigId=QString()):
argument 7 has unexpected type 'QVariant' QgsDataSourceUri.setConnection(str, str, str, str, 

QgsDataSourceUri.SslMode sslmode=QgsDataSourceUri.SslPrefer, str authConfigId=QString()): 
argument 5 has unexpected type 'str' See log for more details

@rouault rouault merged commit 8b1adc5 into qgis:master Nov 13, 2016
@arnaud-morvan arnaud-morvan deleted the processing_postgis_connect branch February 10, 2017 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants