mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: fix sorting dictionaries when some of their names might be None
This commit is contained in:
parent
1473f4a83e
commit
6f355b5297
@ -8,7 +8,6 @@ __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, glob, shutil, re, sys
|
||||
from collections import namedtuple, defaultdict
|
||||
from operator import attrgetter
|
||||
from itertools import chain
|
||||
from functools import partial
|
||||
|
||||
@ -159,7 +158,7 @@ def get_dictionary(locale, exact_match=False):
|
||||
# Now just return any dictionary that matches the language, preferring user
|
||||
# installed ones to builtin ones
|
||||
for collection in (custom_dictionaries(), builtin_dictionaries()):
|
||||
for d in sorted(collection, key=attrgetter('name')):
|
||||
for d in sorted(collection, key=lambda d: d.name or ''):
|
||||
if d.primary_locale.langcode == locale.langcode:
|
||||
return d
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user