Merge pull request #837 from yunzheng/sorted-to-feed-dict

Ensure that keys are sorted in the returned `_to_feed()` dictionary
pull/839/head
Raphaël Vinot 2022-06-09 15:43:45 +02:00 committed by GitHub
commit d31335169c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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))