mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Also ignore unserializable settings when migrating pickle files
This commit is contained in:
parent
7f4ca92b5a
commit
d0d609c715
@ -203,8 +203,7 @@ class DynamicConfig(dict):
|
|||||||
'''
|
'''
|
||||||
A replacement for QSettings that supports dynamic config keys.
|
A replacement for QSettings that supports dynamic config keys.
|
||||||
Returns `None` if a config key is not found. Note that the config
|
Returns `None` if a config key is not found. Note that the config
|
||||||
data is stored in a non human readable pickle file, so only use this
|
data is stored in a JSON file.
|
||||||
class for preferences that you don't intend to have the users edit directly.
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, name='dynamic'):
|
def __init__(self, name='dynamic'):
|
||||||
@ -257,7 +256,7 @@ class DynamicConfig(dict):
|
|||||||
d = self.read_old_serialized_representation()
|
d = self.read_old_serialized_representation()
|
||||||
migrate = bool(d)
|
migrate = bool(d)
|
||||||
if migrate and d:
|
if migrate and d:
|
||||||
raw = json_dumps(d)
|
raw = json_dumps(d, ignore_unserializable=True)
|
||||||
with ExclusiveFile(self.file_path) as f:
|
with ExclusiveFile(self.file_path) as f:
|
||||||
f.seek(0), f.truncate()
|
f.seek(0), f.truncate()
|
||||||
f.write(raw)
|
f.write(raw)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user