mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
newdb: Fix default value for identifiers is mutable
This commit is contained in:
parent
8713ebb0b1
commit
e2c3bb40a5
@ -410,7 +410,10 @@ class IdentifiersField(ManyToManyField):
|
|||||||
def for_book(self, book_id, default_value=None):
|
def for_book(self, book_id, default_value=None):
|
||||||
ids = self.table.book_col_map.get(book_id, ())
|
ids = self.table.book_col_map.get(book_id, ())
|
||||||
if not ids:
|
if not ids:
|
||||||
ids = default_value
|
try:
|
||||||
|
ids = default_value.copy() # in case default_value is a mutable dict
|
||||||
|
except AttributeError:
|
||||||
|
ids = default_value
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
def sort_keys_for_books(self, get_metadata, lang_map, all_book_ids):
|
def sort_keys_for_books(self, get_metadata, lang_map, all_book_ids):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user