El 23/10/2012 8:41, Jürgen E. Fischer escribió:
Hi J.

On Tue, 23. Oct 2012 at 08:00:55 +0200, J. Gaspar Mora Navarro wrote:
I can't find how avoid QGIS stores users logins and passwords from
PostGis in the QGIS project.

If I use this code:

         uri = qgis.core.QgsDataSourceURI()
         uri.setConnection(host, port, database, usuario, password)
Don't set username and password - otherwise they'll get saved.
But in that case QGIS will ask interactively for a the credentials via
QgsCredentials.  You might be able to avoid that using [1], before adding the
layers.


Jürgen

[1] 
http://www.qgis.org/api/classQgsCredentials.html#a13e8e43c36c056e7ece146e985136658

Hello,

Thanks you for your answer,

I found the solution for my problem. Only need change the user and password params for "" value. QGIS ask that interactively only one time and loads all layers from PostGis.

        uri = qgis.core.QgsDataSourceURI()
        uri.setConnection(host, port, database, "", "")


_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to