Skip to content

Commit

Permalink
fix: jans-cli allow emptying list attrbiutes by _null (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar authored Apr 8, 2022
1 parent 8ee47a0 commit 571c5cd
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions jans-cli/cli/config_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,23 +699,27 @@ def get_input(self, values=[], text='Selection', default=None, itype=None,
return default

if itype == 'array' and sitype:
selection = selection.split('_,')
for i, item in enumerate(selection):
if selection == '_null':
selection = []
data_ok = True
try:
selection[i] = self.check_type(item.strip(), sitype)
if selection[i] == '_null':
selection[i] = None
if values:
if not selection[i] in values:
data_ok = False
print(' ' * spacing, self.colored_text(
"Please enter array of {} separated by _,".format(', '.join(values)),
warning_color), sep='')
break
except TypeError as e:
print(' ' * spacing, e, sep='')
data_ok = False
else:
selection = selection.split('_,')
for i, item in enumerate(selection):
data_ok = True
try:
selection[i] = self.check_type(item.strip(), sitype)
if selection[i] == '_null':
selection[i] = None
if values:
if not selection[i] in values:
data_ok = False
print(' ' * spacing, self.colored_text(
"Please enter array of {} separated by _,".format(', '.join(values)),
warning_color), sep='')
break
except TypeError as e:
print(' ' * spacing, e, sep='')
data_ok = False
if data_ok:
break
else:
Expand Down

0 comments on commit 571c5cd

Please sign in to comment.