From b3e205c7c2c0388b72ea9944116f0116fd561794 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 19 Oct 2019 11:35:45 +0100 Subject: [PATCH] Don't save to cache for public only posts --- webinterface.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/webinterface.py b/webinterface.py index 4c934f63..7964b868 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2115,14 +2115,16 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \ else: postStr=galleryStr - # save to posts cache on file - if not os.path.isdir(htmlPostCacheDir): - os.mkdir(htmlPostCacheDir) - try: - with open(cachedPostFilename, 'w') as fp: - fp.write(postStr) - except Exception as e: - print('ERROR: saving post to cache '+str(e)) + if not showPublicOnly: + # save to posts cache on file + if not os.path.isdir(htmlPostCacheDir): + os.mkdir(htmlPostCacheDir) + + try: + with open(cachedPostFilename, 'w') as fp: + fp.write(postStr) + except Exception as e: + print('ERROR: saving post to cache '+str(e)) return postStr