From 64f1edd5b49d12778f3858349d0d85f6bbfa7cae Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Fri, 16 Jun 2017 12:25:27 +0100 Subject: [PATCH] fix: If array passed to add_attrib, add each individually --- pymisp/mispevent.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index b24c62f..62fcf6c 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -593,7 +593,11 @@ class MISPEvent(object): if not found: raise Exception('No attribute with UUID/ID {} found.'.format(attribute_id)) - def add_attribute(self, type, value, **kwargs): + def add_attribute(self, type_, value, **kwargs): attribute = MISPAttribute(self.describe_types) - attribute.set_all_values(type=type, value=value, **kwargs) - self.attributes.append(attribute) + if isinstance(value, list): + for a in value: + self.add_attribute(type_, a, **kwargs) + else: + attribute.set_all_values(type=type_, value=value, **kwargs) + self.attributes.append(attribute)