fix: Allow boolean parameters in search_index

pull/252/head
Raphaël Vinot 2018-07-16 15:01:50 +02:00
parent fd365943a1
commit c2320404dd
1 changed files with 3 additions and 1 deletions

View File

@ -1043,9 +1043,11 @@ class PyMISP(object):
if allowed.get(rule) is None: if allowed.get(rule) is None:
continue continue
param = allowed[rule] param = allowed[rule]
if isinstance(param, bool):
param = int(param)
if not isinstance(param, list): if not isinstance(param, list):
param = [param] param = [param]
param = [x for x in map(str, param)] # param = [x for x in map(str, param)]
if rule in rule_levels: if rule in rule_levels:
if not set(param).issubset(rule_levels[rule]): if not set(param).issubset(rule_levels[rule]):
raise SearchError('Values in your {} are invalid, has to be in {}'.format(rule, ', '.join(str(x) for x in rule_levels[rule]))) raise SearchError('Values in your {} are invalid, has to be in {}'.format(rule, ', '.join(str(x) for x in rule_levels[rule])))