From 481c8e4790009b1d3a8a874e49d86ac0e5c7ea6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 12 Jul 2017 11:24:21 +0200 Subject: [PATCH] Revert "Simplfy MISPEvent.add_attribute" This reverts commit f64f42ac71c11349c1f7dcfc5bf4b2d7c55a0e25. --- pymisp/mispevent.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index df5c00f..62fcf6c 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -593,15 +593,11 @@ class MISPEvent(object): if not found: raise Exception('No attribute with UUID/ID {} found.'.format(attribute_id)) - def add_attribute(self, **kwargs): - if not kwargs.get('value'): - raise NewAttributeError('The value of the attribute is required.') - if not kwargs.get('type'): - raise NewAttributeError('The type of the attribute is required.') + def add_attribute(self, type_, value, **kwargs): attribute = MISPAttribute(self.describe_types) - if isinstance(kwargs.get('value'), list): - for a in kwargs.get('value'): - self.add_attribute(kwargs.get('type'), a, **kwargs) + if isinstance(value, list): + for a in value: + self.add_attribute(type_, a, **kwargs) else: - attribute.set_all_values(type=kwargs.get('type'), value=kwargs.get('value'), **kwargs) + attribute.set_all_values(type=type_, value=value, **kwargs) self.attributes.append(attribute)