From a4e8282028ab74a87cb20fc5b1126b0569840d93 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 11 Sep 2019 17:12:26 +0100 Subject: [PATCH] Don't need to sort keys --- announce.py | 4 ++-- config.py | 4 ++-- like.py | 4 ++-- posts.py | 2 +- shares.py | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/announce.py b/announce.py index 5071660b4..7d5d80b39 100644 --- a/announce.py +++ b/announce.py @@ -104,7 +104,7 @@ def undoAnnounceCollectionEntry(postFilename: str,actor: str,debug: bool) -> Non else: postJsonObject['object']['shares']['totalItems']=len(postJsonObject['object']['shares']['items']) with open(postFilename, 'w') as fp: - commentjson.dump(postJsonObject, fp, indent=4, sort_keys=True) + commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) def updateAnnounceCollection(postFilename: str,actor: str,debug: bool) -> None: """Updates the announcements collection within a post @@ -155,7 +155,7 @@ def updateAnnounceCollection(postFilename: str,actor: str,debug: bool) -> None: print('DEBUG: saving post with shares (announcements) added') pprint(postJsonObject) with open(postFilename, 'w') as fp: - commentjson.dump(postJsonObject, fp, indent=4, sort_keys=True) + commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) def announcedByPerson(postJsonObject: {}, nickname: str,domain: str) -> bool: """Returns True if the given post is announced by the given person diff --git a/config.py b/config.py index b809d4f92..c45aa710f 100644 --- a/config.py +++ b/config.py @@ -19,7 +19,7 @@ def createConfig(baseDir: str) -> None: configJson = { } with open(configFilename, 'w') as fp: - commentjson.dump(configJson, fp, indent=4, sort_keys=True) + commentjson.dump(configJson, fp, indent=4, sort_keys=False) def setConfigParam(baseDir: str, variableName: str, variableValue) -> None: """Sets a configuration value @@ -30,7 +30,7 @@ def setConfigParam(baseDir: str, variableName: str, variableValue) -> None: configJson=commentjson.load(fp) configJson[variableName]=variableValue with open(configFilename, 'w') as fp: - commentjson.dump(configJson, fp, indent=4, sort_keys=True) + commentjson.dump(configJson, fp, indent=4, sort_keys=False) def getConfigParam(baseDir: str, variableName: str): """Gets a configuration value diff --git a/like.py b/like.py index 07aa1aacf..1251c68c2 100644 --- a/like.py +++ b/like.py @@ -61,7 +61,7 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug: else: postJsonObject['object']['likes']['totalItems']=len(postJsonObject['likes']['items']) with open(postFilename, 'w') as fp: - commentjson.dump(postJsonObject, fp, indent=4, sort_keys=True) + commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) def likedByPerson(postJsonObject: {}, nickname: str,domain: str) -> bool: """Returns True if the given post is liked by the given person @@ -134,7 +134,7 @@ def updateLikesCollection(postFilename: str,objectUrl: str, actor: str,debug: bo print('DEBUG: saving post with likes added') pprint(postJsonObject) with open(postFilename, 'w') as fp: - commentjson.dump(postJsonObject, fp, indent=4, sort_keys=True) + commentjson.dump(postJsonObject, fp, indent=4, sort_keys=False) def like(session,baseDir: str,federationList: [],nickname: str,domain: str,port: int, \ ccList: [],httpPrefix: str,objectUrl: str,clientToServer: bool, \ diff --git a/posts.py b/posts.py index 4d2420ab2..c7afc7364 100644 --- a/posts.py +++ b/posts.py @@ -1956,7 +1956,7 @@ def getPublicPostsOfPerson(baseDir: str,nickname: str,domain: str, \ personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,displayName= \ getPersonBox(baseDir,session,wfRequest,personCache, \ projectVersion,httpPrefix,domain,'outbox') - wfResult = json.dumps(wfRequest, indent=4, sort_keys=True) + wfResult = json.dumps(wfRequest, indent=4, sort_keys=False) maxMentions=10 maxEmoji=10 diff --git a/shares.py b/shares.py index bf0dafaed..c43841303 100644 --- a/shares.py +++ b/shares.py @@ -43,7 +43,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \ # remove the item itself del sharesJson[itemID] with open(sharesFilename, 'w') as fp: - commentjson.dump(sharesJson, fp, indent=4, sort_keys=True) + commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) def addShare(baseDir: str, \ httpPrefix: str,nickname: str,domain: str,port: int, \ @@ -138,7 +138,7 @@ def addShare(baseDir: str, \ } with open(sharesFilename, 'w') as fp: - commentjson.dump(sharesJson, fp, indent=4, sort_keys=True) + commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) def expireShares(baseDir: str,nickname: str,domain: str) -> None: """Removes expired items from shares @@ -168,7 +168,7 @@ def expireShares(baseDir: str,nickname: str,domain: str) -> None: if os.path.isfile(itemIDfile+'.gif'): os.remove(itemIDfile+'.gif') with open(sharesFilename, 'w') as fp: - commentjson.dump(sharesJson, fp, indent=4, sort_keys=True) + commentjson.dump(sharesJson, fp, indent=4, sort_keys=False) def getSharesFeedForPerson(baseDir: str, \ domain: str,port: int, \