Fix error flattening

pull/30/head
Raphaël Vinot 2016-08-26 18:22:41 +02:00
parent 5bf6f52301
commit aaaab590f5
1 changed files with 11 additions and 4 deletions

View File

@ -166,7 +166,14 @@ class PyMISP(object):
elif response.get('errors'):
if isinstance(response['errors'], dict):
for where, errors in response['errors'].items():
if isinstance(errors, dict):
for where, msg in errors.items():
messages.append('Error in {}: {}'.format(where, msg))
else:
for e in errors:
if isinstance(e, str):
messages.append(e)
continue
for type_e, msgs in e.items():
for m in msgs:
messages.append('Error in {}: {}'.format(where, m))