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

Victor Olaya volayaf at gmail.com
Tue Oct 18 03:37:39 PDT 2016


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?

2016-10-18 12:29 GMT+02:00 Sandro Santilli <strk at kbt.io>:
> I've noticed lots of "None" strings in the ogr2ogr call from master_2
> branch onward and it looks like what you get from unicode(None) in
> python.
>
> The code checks for parameter values's length being > 0 before adding
> params to ogr2ogr call but all the empty param are now real "None"
> strings (due to unicode call).
>
> This doesn't seem happen in 2.16 branch.
>
> Victor: something to mass-clean ?
>
> --strk;


More information about the Qgis-developer mailing list