chg: Validate attributes in attributes.setter

pull/160/head
Raphaël Vinot 2017-12-21 09:46:09 +01:00
parent 749acd70b5
commit b745fce446
1 changed files with 4 additions and 1 deletions

View File

@ -586,7 +586,10 @@ class MISPEvent(AbstractMISP):
@attributes.setter
def attributes(self, attributes):
self.Attribute = attributes
if all(isinstance(x, MISPAttribute) for x in attributes):
self.Attribute = attributes
else:
raise PyMISPError('All the attributes have to be of type MISPAttribute.')
@property
def related_events(self):