Skip to content

Commit eed09df

Browse files
committed
[tools/xmlparser] Fix from_csv single str val read
Closes #295 When reading a single string value from csv which is containing commata, make sure, that it still remains a single string value and is not split up into a multi value at the comma positions.
1 parent 3a21f0f commit eed09df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

odml/tools/xmlparser.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ def to_csv(val):
4040
def from_csv(value_string):
4141
if not value_string:
4242
return []
43-
if value_string[0] == "[":
43+
if value_string[0] == "[" and value_string[-1] == "]":
4444
value_string = value_string[1:-1]
45+
else:
46+
# This is a single string entry, any comma contained
47+
# is part of the value and must not be used to
48+
# split up the string.
49+
return [value_string]
50+
4551
if not value_string:
4652
return []
4753
stream = StringIO(value_string)

0 commit comments

Comments
 (0)