From 0325b044b84b8fe3d0815242b1aacd212eb523e1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 20 Oct 2019 11:35:13 +0100 Subject: [PATCH] Error message if index isn't updated --- inbox.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inbox.py b/inbox.py index 33db70a5c..fc4e74e68 100644 --- a/inbox.py +++ b/inbox.py @@ -1505,7 +1505,7 @@ 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) -> None: +def inboxUpdateIndex(baseDir: str,handle: str,destinationFilename: str) -> bool: """Updates the index of received posts The new entry is added to the top of the file """ @@ -1514,6 +1514,8 @@ def inboxUpdateIndex(baseDir: str,handle: str,destinationFilename: str) -> None: content = indexFile.read() indexFile.seek(0, 0) indexFile.write(destinationFilename+'\n'+content) + return True + return False def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ baseDir: str,httpPrefix: str,sendThreads: [], \ @@ -1650,7 +1652,8 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ tries+=1 if postSavedToFile: - inboxUpdateIndex(baseDir,handle,destinationFilename) + if not inboxUpdateIndex(baseDir,handle,destinationFilename): + print('ERROR: unable to update inbox index') inboxUpdateCalendar(baseDir,handle,postJsonObject)