Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for duplicate rows in csv subscription list
  • Loading branch information
amit committed Feb 18, 2011
1 parent 2cde902 commit d7c771b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion planet/csv_config.py
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/data/config/basic.csv
@@ -1,3 +1,5 @@
url,name,filters
feed1,one
feed1,one
feed2,two,bar
feed2,two,bar

0 comments on commit d7c771b

Please sign in to comment.