[GRASS-dev] Re: [GRASS GIS] #1491: python libs shouldn't parse freeform text fields with parse_key_val()

GRASS GIS trac at osgeo.org
Tue Nov 15 19:29:11 EST 2011


#1491: python libs shouldn't parse freeform text fields with parse_key_val()
----------------------+-----------------------------------------------------
  Reporter:  hamish   |       Owner:  grass-dev@…              
      Type:  defect   |      Status:  closed                   
  Priority:  normal   |   Milestone:  7.0.0                    
 Component:  Python   |     Version:  svn-trunk                
Resolution:  invalid  |    Keywords:  parsing                  
  Platform:  All      |         Cpu:  All                      
----------------------+-----------------------------------------------------
Changes (by hamish):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 Replying to [comment:2 glynn]:
 > 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".

 ah, that's good. I missed the ,1 and was assuming it was designed to work
 like G_tokenize(), with as many array items as number of seps+1.


 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1491#comment:3>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list