mirror of https://github.com/MISP/PyMISP
Merge pull request #837 from yunzheng/sorted-to-feed-dict
Ensure that keys are sorted in the returned `_to_feed()` dictionarypull/839/head
commit
d31335169c
|
@ -231,7 +231,7 @@ class AbstractMISP(MutableMapping, MISPFileCache, metaclass=ABCMeta):
|
||||||
if hasattr(self, '_set_default') and callable(self._set_default): # type: ignore
|
if hasattr(self, '_set_default') and callable(self._set_default): # type: ignore
|
||||||
self._set_default() # type: ignore
|
self._set_default() # type: ignore
|
||||||
to_return = {}
|
to_return = {}
|
||||||
for field in self._fields_for_feed:
|
for field in sorted(self._fields_for_feed):
|
||||||
if getattr(self, field, None) is not None:
|
if getattr(self, field, None) is not None:
|
||||||
if field in ['timestamp', 'publish_timestamp']:
|
if field in ['timestamp', 'publish_timestamp']:
|
||||||
to_return[field] = self._datetime_to_timestamp(getattr(self, field))
|
to_return[field] = self._datetime_to_timestamp(getattr(self, field))
|
||||||
|
|
Loading…
Reference in New Issue