mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
02aa413ab3
commit
218ea067c0
|
@ -289,7 +289,7 @@ from utils import remove_id_ending
|
|||
from utils import undoLikesCollectionEntry
|
||||
from utils import deletePost
|
||||
from utils import isBlogPost
|
||||
from utils import removeAvatarFromCache
|
||||
from utils import remove_avatar_from_cache
|
||||
from utils import locate_post
|
||||
from utils import get_cached_post_filename
|
||||
from utils import remove_post_from_cache
|
||||
|
@ -6511,7 +6511,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
True)
|
||||
# clear any cached images for this actor
|
||||
idStr = actor_json['id'].replace('/', '-')
|
||||
removeAvatarFromCache(base_dir, idStr)
|
||||
remove_avatar_from_cache(base_dir, idStr)
|
||||
# save the actor to the cache
|
||||
actorCacheFilename = \
|
||||
base_dir + '/cache/actors/' + \
|
||||
|
|
4
inbox.py
4
inbox.py
|
@ -42,7 +42,7 @@ from utils import get_full_domain
|
|||
from utils import remove_id_ending
|
||||
from utils import get_protocol_prefixes
|
||||
from utils import isBlogPost
|
||||
from utils import removeAvatarFromCache
|
||||
from utils import remove_avatar_from_cache
|
||||
from utils import isPublicPost
|
||||
from utils import get_cached_post_filename
|
||||
from utils import remove_post_from_cache
|
||||
|
@ -895,7 +895,7 @@ def _personReceiveUpdate(base_dir: str,
|
|||
# remove avatar if it exists so that it will be refreshed later
|
||||
# when a timeline is constructed
|
||||
actorStr = personJson['id'].replace('/', '-')
|
||||
removeAvatarFromCache(base_dir, actorStr)
|
||||
remove_avatar_from_cache(base_dir, actorStr)
|
||||
return True
|
||||
|
||||
|
||||
|
|
17
utils.py
17
utils.py
|
@ -634,20 +634,21 @@ def get_link_prefixes() -> []:
|
|||
'hyper://', 'gemini://', 'gopher://', 'briar:')
|
||||
|
||||
|
||||
def removeAvatarFromCache(base_dir: str, actorStr: str) -> None:
|
||||
def remove_avatar_from_cache(base_dir: str, actorStr: str) -> None:
|
||||
"""Removes any existing avatar entries from the cache
|
||||
This avoids duplicate entries with differing extensions
|
||||
"""
|
||||
avatarFilenameExtensions = get_image_extensions()
|
||||
for extension in avatarFilenameExtensions:
|
||||
avatarFilename = \
|
||||
avatar_filename_extensions = get_image_extensions()
|
||||
for extension in avatar_filename_extensions:
|
||||
avatar_filename = \
|
||||
base_dir + '/cache/avatars/' + actorStr + '.' + extension
|
||||
if os.path.isfile(avatarFilename):
|
||||
if os.path.isfile(avatar_filename):
|
||||
try:
|
||||
os.remove(avatarFilename)
|
||||
os.remove(avatar_filename)
|
||||
except OSError:
|
||||
print('EX: removeAvatarFromCache ' +
|
||||
'unable to delete cached avatar ' + str(avatarFilename))
|
||||
print('EX: remove_avatar_from_cache ' +
|
||||
'unable to delete cached avatar ' +
|
||||
str(avatar_filename))
|
||||
|
||||
|
||||
def save_json(json_object: {}, filename: str) -> bool:
|
||||
|
|
Loading…
Reference in New Issue