mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix None comparison when sorting the device books list
This commit is contained in:
parent
98b9787611
commit
abd9e6bcf7
@ -1304,8 +1304,8 @@ class DeviceDBSortKeyGen(object): # {{{
|
|||||||
def __call__(self, x):
|
def __call__(self, x):
|
||||||
try:
|
try:
|
||||||
ans = self.keyfunc(getattr(self.db[x], self.attr))
|
ans = self.keyfunc(getattr(self.db[x], self.attr))
|
||||||
except:
|
except Exception:
|
||||||
ans = None
|
ans = ''
|
||||||
return ans
|
return ans
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@ -1485,7 +1485,7 @@ class DeviceBooksModel(BooksModel): # {{{
|
|||||||
'timestamp': ('datetime', functools.partial(dt_factory, assume_utc=True)),
|
'timestamp': ('datetime', functools.partial(dt_factory, assume_utc=True)),
|
||||||
'collections': ('device_collections', lambda x:sorted(x,
|
'collections': ('device_collections', lambda x:sorted(x,
|
||||||
key=sort_key)),
|
key=sort_key)),
|
||||||
'inlibrary': ('in_library', lambda x: x),
|
'inlibrary': ('in_library', lambda x: x or ''),
|
||||||
}[cname]
|
}[cname]
|
||||||
keygen = keygen if callable(keygen) else DeviceDBSortKeyGen(
|
keygen = keygen if callable(keygen) else DeviceDBSortKeyGen(
|
||||||
keygen[0], keygen[1], self.db)
|
keygen[0], keygen[1], self.db)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user