new: Load Org and Orgc as MISPOrganisation

Related to #239
pull/241/head
Raphaël Vinot 2018-06-15 11:41:31 +02:00
parent bb9976a062
commit 2be90774c1
1 changed files with 21 additions and 0 deletions

View File

@ -371,6 +371,21 @@ class MISPEvent(AbstractMISP):
def known_types(self):
return self._types
@property
def org(self):
return self.Org
@property
def orgc(self):
return self.Orgc
@orgc.setter
def orgc(self, orgc):
if isinstance(orgc, MISPOrganisation):
self.Orgc = orgc
else:
raise PyMISPError('Orgc must be of type MISPOrganisation.')
@property
def attributes(self):
return self.Attribute
@ -516,6 +531,12 @@ class MISPEvent(AbstractMISP):
if kwargs.get('Object'):
for obj in kwargs.pop('Object'):
self.add_object(obj)
if kwargs.get('Org'):
self.Org = MISPOrganisation()
self.Org.from_dict(**kwargs.pop('Org'))
if kwargs.get('Orgc'):
self.Orgc = MISPOrganisation()
self.Orgc.from_dict(**kwargs.pop('Orgc'))
super(MISPEvent, self).from_dict(**kwargs)