[QGIS-Developer] Modify project before loading

VOLPES-EXT, Jacky Jacky.VOLPES-EXT at canal-de-provence.com
Thu Nov 26 07:06:58 PST 2020


Hello QGIS dev team :)

I need to modify QGIS project file at reading (loading) time.
The database hostname used in the company is changing soon, and I need this to be transparent for the users.

The problem is that all their layers with the old database connections (uri) will trigger a connection error, having the old hostname.
The idea is to update the .qgs file that is being opened with the new hostname with a text-replacement plugin, save the file, and eventually load it in QGIS.
So that the user will not see any difference or error message.

Sadly, the QgsProject.readLayer signal is sent after the project has been loaded, hence after the connection error messages...

Any suggestion/idea welcome!
Thanks,

Jacky Volpes
Développeur python
HR-Team pour la Société du Canal de Provence
Direction des Systèmes d'Information

Tél. 04 42 66 70 34
Le Tholonet - CS 70064 - 13182 Aix-en-Provence CEDEX 5
[cid:image001.png at 01D34C22.F8A861A0]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201126/5225cc9b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 4649 bytes
Desc: image001.jpg
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201126/5225cc9b/attachment.jpg>


More information about the QGIS-Developer mailing list