Fix for duplicate rows in csv subscription list
This commit is contained in:
parent
2cde902af3
commit
d7c771bfbc
@ -11,9 +11,12 @@ def csv2config(input, config=None):
|
|||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
|
|
||||||
reader = csv.DictReader(input)
|
reader = csv.DictReader(input)
|
||||||
|
d = {}
|
||||||
for row in reader:
|
for row in reader:
|
||||||
section = row[reader.fieldnames[0]]
|
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():
|
for name, value in row.items():
|
||||||
if value and name != reader.fieldnames[0]:
|
if value and name != reader.fieldnames[0]:
|
||||||
config.set(section, name, value)
|
config.set(section, name, value)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
url,name,filters
|
url,name,filters
|
||||||
feed1,one
|
feed1,one
|
||||||
|
feed1,one
|
||||||
|
feed2,two,bar
|
||||||
feed2,two,bar
|
feed2,two,bar
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user