fix: Call the AbstractMISP.from_dict at the end of the function to ensure the edited flag remains false

pull/679/head
Tom King 2021-01-14 18:58:35 +00:00
parent 70a069adee
commit e6cb4ff9ee
1 changed files with 4 additions and 1 deletions

View File

@ -989,7 +989,6 @@ class MISPEventReport(AbstractMISP):
def from_dict(self, **kwargs):
if 'EventReport' in kwargs:
kwargs = kwargs['EventReport']
super().from_dict(**kwargs)
self.distribution = kwargs.pop('distribution', None)
if self.distribution is not None:
@ -1029,6 +1028,8 @@ class MISPEventReport(AbstractMISP):
if kwargs.get('deleted'):
self.deleted = kwargs.pop('deleted')
super().from_dict(**kwargs)
def __repr__(self) -> str:
if hasattr(self, 'name'):
return '<{self.__class__.__name__}(name={self.name})'.format(self=self)
@ -1374,6 +1375,7 @@ class MISPEvent(AbstractMISP):
if kwargs.get('SharingGroup'):
self.SharingGroup = MISPSharingGroup()
self.SharingGroup.from_dict(**kwargs.pop('SharingGroup'))
super(MISPEvent, self).from_dict(**kwargs)
def to_dict(self) -> Dict:
@ -1486,6 +1488,7 @@ class MISPEvent(AbstractMISP):
event_report = MISPEventReport()
event_report.from_dict(name=name, content=content, **kwargs)
self.event_reports.append(event_report)
self.edited = True
return event_report
def get_object_by_id(self, object_id: Union[str, int]) -> MISPObject: