From 59946a6a6de7a8c1ee9541fc91224b17c544cffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 5 Mar 2021 11:58:58 +0100 Subject: [PATCH] chg: take simple_value as value in MISPObject.add_attribute --- pymisp/mispevent.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index 62642c0..d5a5d5b 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -118,6 +118,11 @@ class MISPOrganisation(AbstractMISP): kwargs = kwargs['Organisation'] super(MISPOrganisation, self).from_dict(**kwargs) + def __repr__(self) -> str: + if hasattr(self, 'name'): + return f'<{self.__class__.__name__}(type={self.name})' + return f'<{self.__class__.__name__}(NotInitialized)' + class MISPSharingGroup(AbstractMISP): @@ -909,7 +914,7 @@ class MISPObject(AbstractMISP): """Add an attribute. object_relation is required and the value key is a dictionary with all the keys supported by MISPAttribute""" if simple_value is not None: # /!\ The value *can* be 0 - value = {'value': simple_value} + value['value'] = simple_value if value.get('value') is None: logger.warning("The value of the attribute you're trying to add is None or empty string, skipping it. Object relation: {}".format(object_relation)) return None