[Qgis-developer] QgsProject.instance().writeEntry() with spaces in var name

Olivier Dalang olivier.dalang at gmail.com
Wed Aug 24 18:41:03 PDT 2016


Since https://github.com/qgis/QGIS/pull/469 (quite old) you're supposed to
get a warning message in the console when using invalid keys.

Keys must be valid XML names in order to be properly saved to the file.

To me, being able to use invalid keys in the first place could arguably be
considered as a bug. It would maybe be better to have an exception thrown
in these cases.

Best regards,

Olivier

2016-08-24 17:34 GMT+00:00 Tom Chadwin <tom.chadwin at nnpa.org.uk>:

> I don't know if this deduction from a lot of banging my head against a bug
> is
> correct, but this seems to me to be the behaviour:
>
> 1. QgsProject.instance().writeEntry() a variable with spaces in the
> variable
> name
> 2. Read it back in - this works
> 3. Save your project
> 4. Read it back in - works
> 5. Close your project (open a different one, or close QGIS)
> 6. Reopen your project
> 7. Read it back in - fails
>
> This does not seem to affect var names with no spaces. So the spaces are
> being stripped, but only when written to the project file, not when they
> are
> still in memory?
>
> Can anyone confirm? Is this a bug?
>
>
>
> -----
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
> --
> View this message in context: http://osgeo-org.1560.x6.
> nabble.com/QgsProject-instance-writeEntry-with-
> spaces-in-var-name-tp5282208.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160825/afe6cf37/attachment.html>


More information about the Qgis-developer mailing list