diff --git a/planet/csv_config.py b/planet/csv_config.py index ba3be61..29de08a 100755 --- a/planet/csv_config.py +++ b/planet/csv_config.py @@ -11,9 +11,12 @@ def csv2config(input, config=None): config = ConfigParser() reader = csv.DictReader(input) + d = {} for row in reader: section = row[reader.fieldnames[0]] - config.add_section(section) + if not d.get(section): + config.add_section(section) + d[section] = 1 for name, value in row.items(): if value and name != reader.fieldnames[0]: config.set(section, name, value) diff --git a/tests/data/config/basic.csv b/tests/data/config/basic.csv index b7e4178..d5ea28a 100644 --- a/tests/data/config/basic.csv +++ b/tests/data/config/basic.csv @@ -1,3 +1,5 @@ url,name,filters feed1,one +feed1,one +feed2,two,bar feed2,two,bar