main
Bob Mottram 2020-10-07 19:18:26 +01:00
parent ae8c7c6e30
commit cbab604acc
1 changed files with 4 additions and 10 deletions

View File

@ -21,16 +21,10 @@ def updateFeedsIndex(baseDir: str, domain: str, postId: str) -> None:
indexFilename = basePath + '/outbox.index'
if os.path.isfile(indexFilename):
if postId not in open(indexFilename).read():
try:
with open(indexFilename, 'r+') as feedsFile:
content = feedsFile.read()
feedsFile.seek(0, 0)
feedsFile.write(postId + '\n' + content)
print('DEBUG: feeds post added to index')
except Exception as e:
print('WARN: Failed to write entry to feeds posts index ' +
indexFilename + ' ' + str(e))
feedsFile = open(indexFilename, 'a+')
if feedsFile:
feedsFile.write(postId + '\n')
feedsFile.close()
else:
feedsFile = open(indexFilename, 'w+')
if feedsFile: