mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
custom ratings tables should not support notes
This commit is contained in:
parent
53bfdd6ecf
commit
a0b9a799d9
@ -57,18 +57,20 @@ class Table:
|
||||
def __init__(self, name, metadata, link_table=None):
|
||||
self.name, self.metadata = name, metadata
|
||||
self.sort_alpha = metadata.get('is_multiple', False) and metadata.get('display', {}).get('sort_alpha', False)
|
||||
dt = metadata['datatype']
|
||||
|
||||
# self.unserialize() maps values from the db to python objects
|
||||
self.unserialize = {
|
||||
'datetime': c_parse,
|
||||
'bool': bool
|
||||
}.get(metadata['datatype'], None)
|
||||
}.get(dt)
|
||||
if name == 'authors':
|
||||
# Legacy
|
||||
self.unserialize = lambda x: x.replace('|', ',') if x else ''
|
||||
|
||||
self.link_table = (link_table if link_table else
|
||||
'books_%s_link'%self.metadata['table'])
|
||||
if self.supports_notes and dt == 'rating': # custom ratings table
|
||||
self.supports_notes = False
|
||||
|
||||
def remove_books(self, book_ids, db):
|
||||
return set()
|
||||
|
@ -297,7 +297,7 @@ def get_db_id(val, db, m, table, kmap, rid_map, allow_case_change,
|
||||
table.asort_map[item_id] = aus
|
||||
if hasattr(table, 'link_map'):
|
||||
table.link_map[item_id] = ''
|
||||
if table.supports_notes and isinstance(val, str):
|
||||
if table.supports_notes:
|
||||
db.unretire_note(table.name, item_id, val)
|
||||
elif allow_case_change and val != table.id_map[item_id]:
|
||||
case_changes[item_id] = val
|
||||
|
Loading…
x
Reference in New Issue
Block a user