Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jans-cli allow emptying list attrbiutes by _null #1166

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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