Add debug

main2
Bob Mottram 2019-10-20 11:40:09 +01:00
parent 0325b044b8
commit 6b7120dca7
1 changed files with 4 additions and 2 deletions

View File

@ -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.write('/calendar?year='+str(eventYear)+'?month='+str(eventMonthNumber)+'?day='+str(eventDayOfMonth))
calendarNotificationFile.close() 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 """Updates the index of received posts
The new entry is added to the top of the file The new entry is added to the top of the file
""" """
indexFilename=baseDir+'/accounts/'+handle+'/inbox.index' indexFilename=baseDir+'/accounts/'+handle+'/inbox.index'
if debug:
print('DEBUG: Updating index '+indexFilename)
with open(indexFilename, 'r+') as indexFile: with open(indexFilename, 'r+') as indexFile:
content = indexFile.read() content = indexFile.read()
indexFile.seek(0, 0) indexFile.seek(0, 0)
@ -1652,7 +1654,7 @@ def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \
tries+=1 tries+=1
if postSavedToFile: if postSavedToFile:
if not inboxUpdateIndex(baseDir,handle,destinationFilename): if not inboxUpdateIndex(baseDir,handle,destinationFilename,debug):
print('ERROR: unable to update inbox index') print('ERROR: unable to update inbox index')
inboxUpdateCalendar(baseDir,handle,postJsonObject) inboxUpdateCalendar(baseDir,handle,postJsonObject)