-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[processing][db_manager] Fix connection to postgis #3635
Conversation
Is it still a work in progress ? |
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. |
e8256b4
to
9cd39e7
Compare
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(): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Fix some postgis connection errors, probably due to Python3.