Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 23:53:16 +00:00
parent 0e87c9a362
commit cdd1430c9b
2 changed files with 11 additions and 10 deletions

View File

@ -1762,12 +1762,12 @@ def deletePost(base_dir: str, http_prefix: str,
# remove cached html version of the post # remove cached html version of the post
_deleteCachedHtml(base_dir, nickname, domain, post_json_object) _deleteCachedHtml(base_dir, nickname, domain, post_json_object)
hasObject = False has_object = False
if post_json_object.get('object'): if post_json_object.get('object'):
hasObject = True has_object = True
# remove from moderation index file # remove from moderation index file
if hasObject: if has_object:
if has_object_dict(post_json_object): if has_object_dict(post_json_object):
if post_json_object['object'].get('moderationStatus'): if post_json_object['object'].get('moderationStatus'):
if post_json_object.get('id'): if post_json_object.get('id'):
@ -1775,7 +1775,7 @@ def deletePost(base_dir: str, http_prefix: str,
removeModerationPostFromIndex(base_dir, post_id, debug) removeModerationPostFromIndex(base_dir, post_id, debug)
# remove any hashtags index entries # remove any hashtags index entries
if hasObject: if has_object:
_deleteHashtagsOnPost(base_dir, post_json_object) _deleteHashtagsOnPost(base_dir, post_json_object)
# remove any replies # remove any replies
@ -1984,18 +1984,19 @@ def copytree(src: str, dst: str, symlinks: str = False, ignore: bool = None):
shutil.copy2(s, d) shutil.copy2(s, d)
def getCachedPostDirectory(base_dir: str, nickname: str, domain: str) -> str: def get_cached_post_directory(base_dir: str,
nickname: str, domain: str) -> str:
"""Returns the directory where the html post cache exists """Returns the directory where the html post cache exists
""" """
htmlPostCacheDir = acct_dir(base_dir, nickname, domain) + '/postcache' html_post_cache_dir = acct_dir(base_dir, nickname, domain) + '/postcache'
return htmlPostCacheDir return html_post_cache_dir
def get_cached_post_filename(base_dir: str, nickname: str, domain: str, def get_cached_post_filename(base_dir: str, nickname: str, domain: str,
post_json_object: {}) -> str: post_json_object: {}) -> str:
"""Returns the html cache filename for the given post """Returns the html cache filename for the given post
""" """
cachedPostDir = getCachedPostDirectory(base_dir, nickname, domain) cachedPostDir = get_cached_post_directory(base_dir, nickname, domain)
if not os.path.isdir(cachedPostDir): if not os.path.isdir(cachedPostDir):
# print('ERROR: invalid html cache directory ' + cachedPostDir) # print('ERROR: invalid html cache directory ' + cachedPostDir)
return None return None

View File

@ -39,7 +39,7 @@ from utils import get_full_domain
from utils import is_editor from utils import is_editor
from utils import locate_post from utils import locate_post
from utils import load_json from utils import load_json
from utils import getCachedPostDirectory from utils import get_cached_post_directory
from utils import get_cached_post_filename from utils import get_cached_post_filename
from utils import getProtocolPrefixes from utils import getProtocolPrefixes
from utils import isNewsPost from utils import isNewsPost
@ -250,7 +250,7 @@ def _saveIndividualPostAsHtmlToCache(base_dir: str,
refresh of the timeline refresh of the timeline
""" """
htmlPostCacheDir = \ htmlPostCacheDir = \
getCachedPostDirectory(base_dir, nickname, domain) get_cached_post_directory(base_dir, nickname, domain)
cachedPostFilename = \ cachedPostFilename = \
get_cached_post_filename(base_dir, nickname, domain, post_json_object) get_cached_post_filename(base_dir, nickname, domain, post_json_object)