[Qgis-developer] [processing] OGR imports full of "None" strings, lately

Sandro Santilli strk at kbt.io
Tue Oct 18 03:45:10 PDT 2016


On Tue, Oct 18, 2016 at 12:37:39PM +0200, Victor Olaya wrote:
> I made a fix to the check that verifies if a string parameter is left
> blank or not. Before, it just checked that it was None, so empty
> strings where considered valid values. However, an empty string should
> be considered a null one (mainly, to raise an exception if that is
> used for a parameter that is not optional). Before that, an empty
> string was accepted even if the parameter was mandatory.
> 
> looks like ogr algorithms use unicode(getParameterValue()), and they
> should instead get the param value and check whether is None or not.
> 
> Actually, there is no need to cast it to str or unicode, the value is
> already a string. So it looks like ogr algorithms have to be modified
> to adapat to this.
> 
> A simpler solution is that now, when a null value is passed (None,
> empty string, anything that evaluates to false...), it sets the value
> of the parameter as None. It could set it to an empty string, so no
> need to do any change. Not such a clean solution, but it will work.
> 
> Any thoughts on that?

It sounds like having getParamaterValue() always return a string
(possibly empty) would reduce regression probabilities.

Or do you think it's important to distinguish between empty string
and None ?

--strk;


More information about the Qgis-developer mailing list