Sort the Locate matched objects by their creation date

This change updates the PyKMIP server's support for the Locate
operation, sorting the matched objects found by Locate by their
initial date, newest objects first. This matches the KMIP
specification's definition for how Locate results should be
ordered.
This commit is contained in:
Peter Hamilton 2019-08-08 16:21:18 -04:00 committed by Peter Hamilton
parent c3c03e5091
commit 4938f82772
1 changed files with 7 additions and 0 deletions

View File

@ -1773,6 +1773,13 @@ class KmipEngine(object):
managed_objects = managed_objects_filtered
# Sort the matching results by their creation date.
managed_objects = sorted(
managed_objects,
key=lambda x: x.initial_date,
reverse=True
)
unique_identifiers = [
str(x.unique_identifier) for x in managed_objects
]