chg: Do not split a string into a list in complex query builder

fix #597
pull/663/head
Raphaël Vinot 2020-11-17 14:39:53 +01:00
parent 4e830a435b
commit ef845926b1
1 changed files with 12 additions and 3 deletions

View File

@ -2915,10 +2915,19 @@ class PyMISP:
'''Build a complex search query. MISP expects a dictionary with AND, OR and NOT keys.'''
to_return = {}
if and_parameters:
if isinstance(and_parameters, str):
to_return['AND'] = [and_parameters]
else:
to_return['AND'] = [p for p in and_parameters if p]
if not_parameters:
if isinstance(not_parameters, str):
to_return['NOT'] = [not_parameters]
else:
to_return['NOT'] = [p for p in not_parameters if p]
if or_parameters:
if isinstance(or_parameters, str):
to_return['OR'] = [or_parameters]
else:
to_return['OR'] = [p for p in or_parameters if p]
return to_return