From e6cb4ff9ee958d6c28fadb95eda376ca755c2b49 Mon Sep 17 00:00:00 2001 From: Tom King Date: Thu, 14 Jan 2021 18:58:35 +0000 Subject: [PATCH] fix: Call the AbstractMISP.from_dict at the end of the function to ensure the edited flag remains false --- pymisp/mispevent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index ee126de..2ad4727 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -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: