Check if index exists

main
Bob Mottram 2020-06-24 15:11:10 +01:00
parent 0e3c41db2b
commit a17e2b1ad2
1 changed files with 8 additions and 6 deletions

View File

@ -464,12 +464,14 @@ def deletePost(baseDir: str, httpPrefix: str,
return
# remove from recent posts cache in memory
postId = \
postJsonObject['id'].replace('/activity', '').replace('/', '#')
if postId in recentPostsCache['index']:
recentPostsCache['index'].remove(postId)
if recentPostsCache['json'].get(postId):
del recentPostsCache['json'][postId]
if recentPostsCache:
postId = \
postJsonObject['id'].replace('/activity', '').replace('/', '#')
if recentPostsCache.get('index'):
if postId in recentPostsCache['index']:
recentPostsCache['index'].remove(postId)
if recentPostsCache['json'].get(postId):
del recentPostsCache['json'][postId]
# remove any attachment
removeAttachment(baseDir, httpPrefix, domain, postJsonObject)