storage: allow sorting objects with missing (receipt_)time (#36515)
This commit is contained in:
parent
370357e40a
commit
f4ad46acc6
|
@ -290,6 +290,9 @@ class StorableObject(object):
|
|||
# on all systems so we go the cheap and almost ok way.
|
||||
from .misc import simplify
|
||||
key_function = lambda x: simplify(x.name)
|
||||
elif order_by.endswith('_time'):
|
||||
typed_none = time.gmtime(-10**10) # 1653
|
||||
key_function = lambda x: getattr(x, order_by) or typed_none
|
||||
else:
|
||||
key_function = lambda x: getattr(x, order_by)
|
||||
objects.sort(key=key_function)
|
||||
|
|
Loading…
Reference in New Issue