Hi Régis, I can't help you with the Python script to process your files, but I have a suggestion:
Use a PostgreSQL service instead of hard-coded IP addresses, names or aliases. In such a scenario you can easily change between a production and test server and more easily migrate to a new machine. Also, on a laptop you can point the service to localhost (for mobile laptops) and within your organizations LAN you can point to the production server. All without touching the .qgs project file. We in Uster are using PostgreSQL service names for several years now and I like them. Unfortunately the concept of PostgreSQL services is not very well-known among the PostgreSQL users. See http://www.postgresql.org/docs/current/static/libpq-pgservice.html and http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS Andreas Am 01.07.2014 14:01, schrieb Régis Haubourg: > Hi All, > We are preparing a great postgres migration here, and to make it > transparent, we have given virtual aliases to our server. > User's QGS file refer today to hard coded IP or aliases (172.16.9.147 or > vslin147). > > We have been migrating most qgs using bash script with grep and sed, but we > seem to touch the limits of such approaches (error handling, disconnected > disks.. editions pending ., some are zipped ) > > My question, do you think it is possible to have a python function (plugin > or user function), that will catch qgs before loading it, and that will > substitute the host with the new value, before qgis loads the datasource ? > > Any idea? > > Cheers > > Régis > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/python-function-to-upgrade-qgs-datasources-tp5149022.html > Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. > _______________________________________________ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-developer > _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer