mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-25 22:56:21 +01:00
py3: Fix sorting on one-one fields that can have None values
Fixes #1878388 [Private bug](https://bugs.launchpad.net/calibre/+bug/1878388)
This commit is contained in:
parent
e40834080e
commit
9c05bb0ff3
1 changed files with 7 additions and 0 deletions
|
|
@ -192,6 +192,13 @@ def sort_keys_for_books(self, get_metadata, lang_map):
|
|||
dk = self._default_sort_key
|
||||
sk = self._sort_key
|
||||
if sk is IDENTITY:
|
||||
if dk is not None:
|
||||
def none_safe_key(book_id):
|
||||
ans = bcmg(book_id, dk)
|
||||
if ans is None:
|
||||
ans = dk
|
||||
return ans
|
||||
return none_safe_key
|
||||
return lambda book_id:bcmg(book_id, dk)
|
||||
return lambda book_id:sk(bcmg(book_id, dk))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue