Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for duplicate rows in csv subscription list

  • Loading branch information...
commit d7c771bfbc7e7a2a0b58089b32f6013ce5109c72 1 parent 2cde902
@amit authored
Showing with 6 additions and 1 deletion.
  1. +4 −1 planet/csv_config.py
  2. +2 −0  tests/data/config/basic.csv
View
5 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)
View
2  tests/data/config/basic.csv
@@ -1,3 +1,5 @@
url,name,filters
feed1,one
+feed1,one
+feed2,two,bar
feed2,two,bar
Please sign in to comment.
Something went wrong with that request. Please try again.