mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
...
This commit is contained in:
parent
12271efe3d
commit
bbbcc7774e
@ -106,10 +106,15 @@ 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 not self.disable_setting and val != self[key]:
|
if not self.disable_setting:
|
||||||
raw = self.to_raw(val)
|
try:
|
||||||
self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
|
current_val = self[key]
|
||||||
dict.__setitem__(self, key, val)
|
except KeyError:
|
||||||
|
current_val = object()
|
||||||
|
if val != current_val:
|
||||||
|
raw = self.to_raw(val)
|
||||||
|
self.db.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key, raw))
|
||||||
|
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