mirror of https://gitlab.com/bashrc2/epicyon
Append
parent
ae8c7c6e30
commit
cbab604acc
|
@ -21,16 +21,10 @@ def updateFeedsIndex(baseDir: str, domain: str, postId: str) -> None:
|
||||||
indexFilename = basePath + '/outbox.index'
|
indexFilename = basePath + '/outbox.index'
|
||||||
|
|
||||||
if os.path.isfile(indexFilename):
|
if os.path.isfile(indexFilename):
|
||||||
if postId not in open(indexFilename).read():
|
feedsFile = open(indexFilename, 'a+')
|
||||||
try:
|
if feedsFile:
|
||||||
with open(indexFilename, 'r+') as feedsFile:
|
feedsFile.write(postId + '\n')
|
||||||
content = feedsFile.read()
|
feedsFile.close()
|
||||||
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))
|
|
||||||
else:
|
else:
|
||||||
feedsFile = open(indexFilename, 'w+')
|
feedsFile = open(indexFilename, 'w+')
|
||||||
if feedsFile:
|
if feedsFile:
|
||||||
|
|
Loading…
Reference in New Issue