mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not write to the db when storing preferences that have not actually changed
This commit is contained in:
parent
1ddde725be
commit
12271efe3d
@ -106,11 +106,10 @@ class DBPrefs(dict): # {{{
|
|||||||
self.db.execute('DELETE FROM preferences WHERE key=?', (key,))
|
self.db.execute('DELETE FROM preferences WHERE key=?', (key,))
|
||||||
|
|
||||||
def __setitem__(self, key, val):
|
def __setitem__(self, key, val):
|
||||||
if self.disable_setting:
|
if not self.disable_setting and val != self[key]:
|
||||||
return
|
raw = self.to_raw(val)
|
||||||
raw = self.to_raw(val)
|
self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
|
||||||
self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
|
dict.__setitem__(self, key, val)
|
||||||
dict.__setitem__(self, key, val)
|
|
||||||
|
|
||||||
def set(self, key, val):
|
def set(self, key, val):
|
||||||
self.__setitem__(key, val)
|
self.__setitem__(key, val)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user