From 1af83ed1aa6eb64c9630e4fbf86a5b4ad4b0102f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 2 Feb 2021 21:08:33 +0000 Subject: [PATCH] Replace nickname in cached html --- posts.py | 5 +++++ tests.py | 17 +++++++++++++++++ webapp_post.py | 42 +++++++++++++++++++++++++++++++++++++++--- webapp_timeline.py | 3 ++- 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/posts.py b/posts.py index 8cbcede47..a0920284c 100644 --- a/posts.py +++ b/posts.py @@ -1831,11 +1831,16 @@ def threadSendPost(session, postJsonStr: str, federationList: [], for attempt in range(20): postResult = None unauthorized = False + if debug: + print('Getting postJsonString for ' + inboxUrl) try: postResult, unauthorized = \ postJsonString(session, postJsonStr, federationList, inboxUrl, signatureHeaderJson, debug) + if debug: + print('Obtained postJsonString for ' + inboxUrl + + ' unauthorized: ' + str(unauthorized)) except Exception as e: print('ERROR: postJsonString failed ' + str(e)) if unauthorized: diff --git a/tests.py b/tests.py index 3ff5eb714..83ecabca7 100644 --- a/tests.py +++ b/tests.py @@ -95,6 +95,7 @@ from newswire import getNewswireTags from newswire import parseFeedDate from mastoapiv1 import getMastoApiV1IdFromNickname from mastoapiv1 import getNicknameFromMastoApiV1Id +from webapp_post import prepareHtmlPostNickname testServerAliceRunning = False testServerBobRunning = False @@ -3072,9 +3073,25 @@ def testDomainHandling(): assert decodedHost(testDomain) == "espaƱa.icom.museum" +def testPrepareHtmlPostNickname(): + print('testPrepareHtmlPostNickname') + postHtml = '