Update types, allow 0 as attribute value

pull/63/head
Raphaël Vinot 2017-03-12 23:05:13 +01:00
parent e029b60455
commit 638ad3d4b7
2 changed files with 13 additions and 7 deletions

View File

@ -69,6 +69,10 @@
"default_category": "Payload delivery",
"to_ids": 1
},
"float": {
"default_category": "Other",
"to_ids": 0
},
"url": {
"default_category": "External analysis",
"to_ids": 1
@ -544,6 +548,7 @@
"email-dst",
"email-subject",
"email-attachment",
"float",
"url",
"http-method",
"user-agent",
@ -998,14 +1003,15 @@
"other"
],
"Other": [
"comment",
"text",
"other",
"size-in-bytes",
"counter",
"datetime",
"cpe",
"port",
"comment",
"text",
"other"
"float"
]
}
}

View File

@ -130,9 +130,9 @@ class MISPAttribute(object):
type_defaults = self.sane_default[self.type]
if kwargs.get('value'):
self.value = kwargs['value']
elif not self.value:
self.value = kwargs.get('value')
if self.value is None:
raise NewAttributeError('The value of the attribute is required.')
# Default values
@ -444,7 +444,7 @@ class MISPEvent(object):
raise NewEventError('{} is invalid, the analysis has to be in 0, 1, 2'.format(self.analysis))
if kwargs.get('published') is not None:
self.unpublish()
if kwargs.get("published") == True:
if kwargs.get("published") is True:
self.publish()
if kwargs.get('date'):
self.set_date(kwargs['date'])