Handle failure to load post

main2
Bob Mottram 2019-09-17 12:06:59 +01:00
parent ad89134511
commit 2210837a33
1 changed files with 8 additions and 2 deletions

View File

@ -2137,8 +2137,14 @@ def htmlIndividualPost(translate: {}, \
postFilename=locatePost(baseDir,nickname,domain,postJsonObject['object']['inReplyTo'])
if not postFilename:
break
with open(postFilename, 'r') as fp:
postJsonObject=commentjson.load(fp)
loadedPost=False
try:
with open(postFilename, 'r') as fp:
postJsonObject=commentjson.load(fp)
loadedPost=True
except Exception as e:
print(e)
if loadedPost:
postStr= \
individualPostAsHtml(iconsDir,translate,None, \
baseDir,session,wfRequest,personCache, \