summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Chakradeo <amit@chakradeo.net>2011-02-17 17:04:43 -0800
committerAmit Chakradeo <amit@chakradeo.net>2011-02-17 17:04:43 -0800
commitd7c771bfbc7e7a2a0b58089b32f6013ce5109c72 (patch)
tree083cedfa3922713872eef51aa12d3c72d2aeeebf
parent2cde902af3969e822e35bf3a14a5b66018f3b765 (diff)
downloadplanetpixels-d7c771bfbc7e7a2a0b58089b32f6013ce5109c72.tar.gz
planetpixels-d7c771bfbc7e7a2a0b58089b32f6013ce5109c72.tar.bz2
Fix for duplicate rows in csv subscription list
-rwxr-xr-xplanet/csv_config.py5
-rw-r--r--tests/data/config/basic.csv2
2 files changed, 6 insertions, 1 deletions
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