Ensure that keys are sorted in the returned `_to_feed()` dictionary

This allows for better deterministic feed output generation.
pull/837/head
Yun Zheng Hu 2022-06-09 14:38:06 +02:00
parent bb9f053b68
commit 49b6a45502
1 changed files with 1 additions and 1 deletions

View File

@ -231,7 +231,7 @@ class AbstractMISP(MutableMapping, MISPFileCache, metaclass=ABCMeta):
if hasattr(self, '_set_default') and callable(self._set_default): # type: ignore
self._set_default() # type: ignore
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 field in ['timestamp', 'publish_timestamp']:
to_return[field] = self._datetime_to_timestamp(getattr(self, field))