From c5b273512b6110a25223b7ff044a8818c6707bc9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 17 Mar 2021 21:46:52 +0000 Subject: [PATCH] Simplify --- outbox.py | 15 ++++++++------- pgp.py | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/outbox.py b/outbox.py index 038e069eb..7c8a822dd 100644 --- a/outbox.py +++ b/outbox.py @@ -127,24 +127,25 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {}, continue if 'attachment' in actorJson: found = False + ctr = 0 for propertyValue in actorJson['attachment']: if propertyValue != 'PropertyValue': + ctr += 1 continue if propertyValue['name'] == newPropertyValue['name']: - if propertyValue['value'] != \ - newPropertyValue['value']: - propertyValue['value'] = \ - newPropertyValue['value'] - actorChanged = True - found = True + found = True break + ctr += 1 if not found: actorJson['attachment'].append({ "name": newPropertyValue['name'], "type": "PropertyValue", "value": newPropertyValue['value'] }) - actorChanged = True + else: + actorJson['attachment'][ctr]['value'] = \ + newPropertyValue['value'] + actorChanged = True # save actor to file if actorChanged: saveJson(actorJson, actorFilename) diff --git a/pgp.py b/pgp.py index 8409a7007..9b18c8cc3 100644 --- a/pgp.py +++ b/pgp.py @@ -7,7 +7,6 @@ __email__ = "bob@freedombone.net" __status__ = "Production" import os -import time import subprocess from pathlib import Path from person import getActorJson