mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-16 21:55:50 +01:00
newdb: get_metadata() should have sorted formats list in mi.formats
This commit is contained in:
parent
20f414a7f5
commit
fda8ce7abb
3 changed files with 3 additions and 3 deletions
|
|
@ -223,7 +223,7 @@ def _get_metadata(self, book_id, get_user_categories=True): # {{{
|
|||
good_formats = None
|
||||
else:
|
||||
mi.format_metadata = FormatMetadata(self, book_id, formats)
|
||||
good_formats = FormatsList(formats, mi.format_metadata)
|
||||
good_formats = FormatsList(sorted(formats), mi.format_metadata)
|
||||
# These three attributes are returned by the db2 get_metadata(),
|
||||
# however, we dont actually use them anywhere other than templates, so
|
||||
# they have been removed, to avoid unnecessary overhead. The templates
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ def func(dbref, book_id, cache):
|
|||
if m:
|
||||
format_metadata[fmt] = m
|
||||
if field == 'formats':
|
||||
return list(format_metadata) or None
|
||||
return sorted(format_metadata) or None
|
||||
return format_metadata
|
||||
return func
|
||||
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ def test_proxy_metadata(self): # {{{
|
|||
for field in STANDARD_METADATA_FIELDS | {'#series_index'}:
|
||||
f = lambda x: x
|
||||
if field == 'formats':
|
||||
f = lambda x: x if x is None else set(x)
|
||||
f = lambda x: x if x is None else tuple(x)
|
||||
self.assertEqual(f(getattr(mi, field)), f(getattr(pmi, field)),
|
||||
'Standard field: %s not the same for book %s' % (field, book_id))
|
||||
self.assertEqual(mi.format_field(field), pmi.format_field(field),
|
||||
|
|
|
|||
Loading…
Reference in a new issue