fix: [objects] Allow the value of an attribute to be 0

pull/426/head
Raphaël Vinot 2019-07-22 00:42:44 +02:00
parent 31499bdc7e
commit a40e383b18
1 changed files with 2 additions and 1 deletions

View File

@ -1228,9 +1228,10 @@ class MISPObject(AbstractMISP):
def add_attribute(self, object_relation, simple_value=None, **value):
"""Add an attribute. object_relation is required and the value key is a
dictionary with all the keys supported by MISPAttribute"""
if simple_value:
if simple_value is not None: # /!\ The value *can* be 0
value = {'value': simple_value}
if value.get('value') is None:
# FIXME: Add a warning to the user, silently discarding the call isn't the best idea
return None
if self._known_template:
if self._definition['attributes'].get(object_relation):