Sort keys in JSON config files for easier diffing

Fixes #1814990 [Sort JSON keys in configuration files](https://bugs.launchpad.net/calibre/+bug/1814990)
This commit is contained in:
Kovid Goyal 2019-02-07 09:51:04 +05:30
parent aafc038b17
commit 215c05d2e2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -412,7 +412,7 @@ class JSONConfig(XMLConfig):
return json.loads(raw.decode('utf-8'), object_hook=from_json) return json.loads(raw.decode('utf-8'), object_hook=from_json)
def to_raw(self): def to_raw(self):
return json.dumps(self, indent=2, default=to_json) return json.dumps(self, indent=2, default=to_json, sort_keys=True)
def __getitem__(self, key): def __getitem__(self, key):
try: try: