Allow FieldAttribute lists and sets to be set from a comma separated string

pull/14967/head
Toshio Kuratomi 9 years ago
parent 88772b6003
commit d665911bab

@ -334,6 +334,9 @@ class Base:
if value is None:
value = []
elif not isinstance(value, list):
if isinstance(value, string_types):
value = value.split(',')
else:
value = [ value ]
if attribute.listof is not None:
for item in value:
@ -346,8 +349,12 @@ class Base:
elif attribute.isa == 'set':
if value is None:
value = set()
elif not isinstance(value, (list, set)):
if isinstance(value, string_types):
value = value.split(',')
else:
if not isinstance(value, (list, set)):
# Making a list like this handles strings of
# text and bytes properly
value = [ value ]
if not isinstance(value, set):
value = set(value)

Loading…
Cancel
Save