[GRASS-dev] Re: [GRASS GIS] #1491: python libs shouldn't parse
freeform text fields with parse_key_val()
GRASS GIS
trac at osgeo.org
Mon Nov 14 16:05:54 EST 2011
#1491: python libs shouldn't parse freeform text fields with parse_key_val()
---------------------+------------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Keywords: parsing | Platform: All
Cpu: All |
---------------------+------------------------------------------------------
Comment(by glynn):
Replying to [ticket:1491 hamish]:
> raster.py and vector.py use core.py's parse_key_val() to evaluate the
results of r.info and v.info, and report the result of `kv[1]` using `=`
as the field separator.
>
> r.info's title, vdatum, and units results, and most of v.info's extended
metadata results can contain free-from text, which can contain `=` chars.
And so text containing that will get cut off and only give the result up
to the first `=`.
parse_key_val() only splits at the first separator:
{{{
kv = line.split(sep, 1)
}}}
This results in a two-element tuple, with the first element containing
everything before the first separator, and the second element containing
everything after, even if it contains the separator character.
Unless there are specific cases which either actually don't work or which
are uncertain based upon the actual behaviour of parse_key_val(), this
ticket should be closed as "invalid".
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1491#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list