From 6b7120dca75f9650718b7620537545016996a2a0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 20 Oct 2019 11:40:09 +0100 Subject: [PATCH] Add debug --- inbox.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index fc4e74e6..4b731164 100644 --- a/inbox.py +++ b/inbox.py @@ -1505,11 +1505,13 @@ def inboxUpdateCalendar(baseDir: str,handle: str,postJsonObject: {}) -> None: calendarNotificationFile.write('/calendar?year='+str(eventYear)+'?month='+str(eventMonthNumber)+'?day='+str(eventDayOfMonth)) calendarNotificationFile.close() -def inboxUpdateIndex(baseDir: str,handle: str,destinationFilename: str) -> bool: +def inboxUpdateIndex(baseDir: str,handle: str,destinationFilename: str,debug: bool) -> bool: """Updates the index of received posts The new entry is added to the top of the file """ indexFilename=baseDir+'/accounts/'+handle+'/inbox.index' + if debug: + print('DEBUG: Updating index '+indexFilename) with open(indexFilename, 'r+') as indexFile: content = indexFile.read() indexFile.seek(0, 0) @@ -1652,7 +1654,7 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ tries+=1 if postSavedToFile: - if not inboxUpdateIndex(baseDir,handle,destinationFilename): + if not inboxUpdateIndex(baseDir,handle,destinationFilename,debug): print('ERROR: unable to update inbox index') inboxUpdateCalendar(baseDir,handle,postJsonObject)