forked from indymedia/epicyon
Don't use cache for public only posts
parent
4d349544ed
commit
966baef1cd
|
@ -1728,23 +1728,24 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \
|
||||||
showPublicOnly=False) -> str:
|
showPublicOnly=False) -> str:
|
||||||
""" Shows a single post as html
|
""" Shows a single post as html
|
||||||
"""
|
"""
|
||||||
# if a cached version of the post already exists then fetch it
|
if not showPublicOnly:
|
||||||
htmlPostCacheDir=baseDir+'/accounts/'+nickname+'@'+domain+'/postcache'
|
# if a cached version of the post already exists then fetch it
|
||||||
cachedPostFilename=htmlPostCacheDir+'/'+postJsonObject['id'].replace('/activity','').replace('/','#')+'.html'
|
htmlPostCacheDir=baseDir+'/accounts/'+nickname+'@'+domain+'/postcache'
|
||||||
if os.path.isfile(cachedPostFilename):
|
cachedPostFilename=htmlPostCacheDir+'/'+postJsonObject['id'].replace('/activity','').replace('/','#')+'.html'
|
||||||
postStr=''
|
if os.path.isfile(cachedPostFilename):
|
||||||
tries=0
|
postStr=''
|
||||||
while tries<3:
|
tries=0
|
||||||
try:
|
while tries<3:
|
||||||
with open(cachedPostFilename, 'r') as file:
|
try:
|
||||||
postStr = file.read()
|
with open(cachedPostFilename, 'r') as file:
|
||||||
break
|
postStr = file.read()
|
||||||
except Exception as e:
|
break
|
||||||
print(e)
|
except Exception as e:
|
||||||
# no sleep
|
print(e)
|
||||||
tries+=1
|
# no sleep
|
||||||
if postStr:
|
tries+=1
|
||||||
return postStr
|
if postStr:
|
||||||
|
return postStr
|
||||||
|
|
||||||
# If this is the inbox timeline then don't show the repeat icon on any DMs
|
# If this is the inbox timeline then don't show the repeat icon on any DMs
|
||||||
showRepeatIcon=showRepeats
|
showRepeatIcon=showRepeats
|
||||||
|
|
Loading…
Reference in New Issue