mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 22:53:42 +02:00
Do a commit when preferences are restored. Ensure that the in-memory copy of the prefs is correct after restore.
This commit is contained in:
parent
c888503ce0
commit
4205c7b8a1
1 changed files with 4 additions and 2 deletions
|
|
@ -84,13 +84,15 @@ def read_serialized(self, library_path):
|
|||
try:
|
||||
from_filename = os.path.join(library_path, 'metadata_db_prefs.json')
|
||||
with open(from_filename, "rb") as f:
|
||||
self.clear()
|
||||
d = json.load(f, object_hook=from_json)
|
||||
self.db.conn.execute('DELETE FROM preferences')
|
||||
for k,v in d.iteritems():
|
||||
raw = self.to_raw(v)
|
||||
self.db.conn.execute(
|
||||
'INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)',
|
||||
(k, raw))
|
||||
'INSERT INTO preferences (key,val) VALUES (?,?)', (k, raw))
|
||||
self.db.conn.commit()
|
||||
self.update(d)
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
Loading…
Reference in a new issue