mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
newdb: get_metadata() should have sorted formats list in mi.formats
This commit is contained in:
parent
20f414a7f5
commit
fda8ce7abb
@ -223,7 +223,7 @@ class Cache(object):
|
||||
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 fmt_getter(field):
|
||||
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 @@ class ReadingTest(BaseTest):
|
||||
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…
x
Reference in New Issue
Block a user