mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
81ad6a7160
commit
f1370531ab
|
@ -15,7 +15,7 @@ from utils import remove_domain_port
|
||||||
from utils import has_users_path
|
from utils import has_users_path
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import removePostFromCache
|
from utils import remove_post_from_cache
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
|
@ -57,7 +57,7 @@ def undoBookmarksCollectionEntry(recent_posts_cache: {},
|
||||||
print('EX: undoBookmarksCollectionEntry ' +
|
print('EX: undoBookmarksCollectionEntry ' +
|
||||||
'unable to delete cached post file ' +
|
'unable to delete cached post file ' +
|
||||||
str(cachedPostFilename))
|
str(cachedPostFilename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
# remove from the index
|
# remove from the index
|
||||||
bookmarksIndexFilename = \
|
bookmarksIndexFilename = \
|
||||||
|
@ -177,7 +177,7 @@ def updateBookmarksCollection(recent_posts_cache: {},
|
||||||
print('EX: updateBookmarksCollection ' +
|
print('EX: updateBookmarksCollection ' +
|
||||||
'unable to delete cached post ' +
|
'unable to delete cached post ' +
|
||||||
str(cachedPostFilename))
|
str(cachedPostFilename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
if not post_json_object.get('object'):
|
if not post_json_object.get('object'):
|
||||||
if debug:
|
if debug:
|
||||||
|
|
10
daemon.py
10
daemon.py
|
@ -292,7 +292,7 @@ from utils import isBlogPost
|
||||||
from utils import removeAvatarFromCache
|
from utils import removeAvatarFromCache
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import removePostFromCache
|
from utils import remove_post_from_cache
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
|
@ -560,8 +560,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'unable to delete ' +
|
'unable to delete ' +
|
||||||
cachedPostFilename)
|
cachedPostFilename)
|
||||||
# remove from memory cache
|
# remove from memory cache
|
||||||
removePostFromCache(post_json_object,
|
remove_post_from_cache(post_json_object,
|
||||||
self.server.recent_posts_cache)
|
self.server.recent_posts_cache)
|
||||||
else:
|
else:
|
||||||
print('ERROR: unable to post vote to outbox')
|
print('ERROR: unable to post vote to outbox')
|
||||||
else:
|
else:
|
||||||
|
@ -16769,8 +16769,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('EX: _receiveNewPostProcess ' +
|
print('EX: _receiveNewPostProcess ' +
|
||||||
'unable to delete ' + cachedFilename)
|
'unable to delete ' + cachedFilename)
|
||||||
# remove from memory cache
|
# remove from memory cache
|
||||||
removePostFromCache(post_json_object,
|
remove_post_from_cache(post_json_object,
|
||||||
self.server.recent_posts_cache)
|
self.server.recent_posts_cache)
|
||||||
# change the blog post title
|
# change the blog post title
|
||||||
post_json_object['object']['summary'] = \
|
post_json_object['object']['summary'] = \
|
||||||
fields['subject']
|
fields['subject']
|
||||||
|
|
6
inbox.py
6
inbox.py
|
@ -45,7 +45,7 @@ from utils import isBlogPost
|
||||||
from utils import removeAvatarFromCache
|
from utils import removeAvatarFromCache
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import removePostFromCache
|
from utils import remove_post_from_cache
|
||||||
from utils import urlPermitted
|
from utils import urlPermitted
|
||||||
from utils import createInboxQueueDir
|
from utils import createInboxQueueDir
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
|
@ -938,7 +938,7 @@ def _receiveUpdateToQuestion(recent_posts_cache: {}, message_json: {},
|
||||||
print('EX: _receiveUpdateToQuestion unable to delete ' +
|
print('EX: _receiveUpdateToQuestion unable to delete ' +
|
||||||
cachedPostFilename)
|
cachedPostFilename)
|
||||||
# remove from memory cache
|
# remove from memory cache
|
||||||
removePostFromCache(message_json, recent_posts_cache)
|
remove_post_from_cache(message_json, recent_posts_cache)
|
||||||
|
|
||||||
|
|
||||||
def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
|
def _receiveUpdate(recent_posts_cache: {}, session, base_dir: str,
|
||||||
|
@ -3010,7 +3010,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
|
||||||
if not questionPostFilename:
|
if not questionPostFilename:
|
||||||
return
|
return
|
||||||
|
|
||||||
removePostFromCache(questionJson, recent_posts_cache)
|
remove_post_from_cache(questionJson, recent_posts_cache)
|
||||||
# ensure that the cached post is removed if it exists, so
|
# ensure that the cached post is removed if it exists, so
|
||||||
# that it then will be recreated
|
# that it then will be recreated
|
||||||
cachedPostFilename = \
|
cachedPostFilename = \
|
||||||
|
|
4
like.py
4
like.py
|
@ -26,7 +26,7 @@ from utils import has_group_type
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import removePostFromCache
|
from utils import remove_post_from_cache
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from posts import sendSignedJson
|
from posts import sendSignedJson
|
||||||
from session import postJson
|
from session import postJson
|
||||||
|
@ -424,7 +424,7 @@ def updateLikesCollection(recent_posts_cache: {},
|
||||||
|
|
||||||
# remove any cached version of this post so that the
|
# remove any cached version of this post so that the
|
||||||
# like icon is changed
|
# like icon is changed
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
cachedPostFilename = \
|
cachedPostFilename = \
|
||||||
get_cached_post_filename(base_dir, nickname,
|
get_cached_post_filename(base_dir, nickname,
|
||||||
domain, post_json_object)
|
domain, post_json_object)
|
||||||
|
|
|
@ -28,7 +28,7 @@ from utils import has_group_type
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import removePostFromCache
|
from utils import remove_post_from_cache
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import containsInvalidChars
|
from utils import containsInvalidChars
|
||||||
from posts import sendSignedJson
|
from posts import sendSignedJson
|
||||||
|
@ -454,7 +454,7 @@ def updateReactionCollection(recent_posts_cache: {},
|
||||||
|
|
||||||
# remove any cached version of this post so that the
|
# remove any cached version of this post so that the
|
||||||
# reaction icon is changed
|
# reaction icon is changed
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
cachedPostFilename = \
|
cachedPostFilename = \
|
||||||
get_cached_post_filename(base_dir, nickname,
|
get_cached_post_filename(base_dir, nickname,
|
||||||
domain, post_json_object)
|
domain, post_json_object)
|
||||||
|
|
67
utils.py
67
utils.py
|
@ -1567,7 +1567,8 @@ def _isBookmarked(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def removePostFromCache(post_json_object: {}, recent_posts_cache: {}) -> None:
|
def remove_post_from_cache(post_json_object: {},
|
||||||
|
recent_posts_cache: {}) -> None:
|
||||||
""" if the post exists in the recent posts cache then remove it
|
""" if the post exists in the recent posts cache then remove it
|
||||||
"""
|
"""
|
||||||
if not recent_posts_cache:
|
if not recent_posts_cache:
|
||||||
|
@ -1603,16 +1604,16 @@ def _deleteCachedHtml(base_dir: str, nickname: str, domain: str,
|
||||||
post_json_object: {}):
|
post_json_object: {}):
|
||||||
"""Removes cached html file for the given post
|
"""Removes cached html file for the given post
|
||||||
"""
|
"""
|
||||||
cachedPostFilename = \
|
cached_post_filename = \
|
||||||
get_cached_post_filename(base_dir, nickname, domain, post_json_object)
|
get_cached_post_filename(base_dir, nickname, domain, post_json_object)
|
||||||
if cachedPostFilename:
|
if cached_post_filename:
|
||||||
if os.path.isfile(cachedPostFilename):
|
if os.path.isfile(cached_post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(cachedPostFilename)
|
os.remove(cached_post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: _deleteCachedHtml ' +
|
print('EX: _deleteCachedHtml ' +
|
||||||
'unable to delete cached post file ' +
|
'unable to delete cached post file ' +
|
||||||
str(cachedPostFilename))
|
str(cached_post_filename))
|
||||||
|
|
||||||
|
|
||||||
def _deleteHashtagsOnPost(base_dir: str, post_json_object: {}) -> None:
|
def _deleteHashtagsOnPost(base_dir: str, post_json_object: {}) -> None:
|
||||||
|
@ -1741,7 +1742,7 @@ def deletePost(base_dir: str, http_prefix: str,
|
||||||
return
|
return
|
||||||
|
|
||||||
# remove from recent posts cache in memory
|
# remove from recent posts cache in memory
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
# remove from conversation index
|
# remove from conversation index
|
||||||
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
|
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
|
||||||
|
@ -2004,8 +2005,8 @@ def get_cached_post_filename(base_dir: str, nickname: str, domain: str,
|
||||||
# print('ERROR: invalid html cache directory ' + cachedPostDir)
|
# print('ERROR: invalid html cache directory ' + cachedPostDir)
|
||||||
return None
|
return None
|
||||||
cachedPostId = removeIdEnding(post_json_object['id'])
|
cachedPostId = removeIdEnding(post_json_object['id'])
|
||||||
cachedPostFilename = cachedPostDir + '/' + cachedPostId.replace('/', '#')
|
cached_post_filename = cachedPostDir + '/' + cachedPostId.replace('/', '#')
|
||||||
return cachedPostFilename + '.html'
|
return cached_post_filename + '.html'
|
||||||
|
|
||||||
|
|
||||||
def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
|
def updateRecentPostsCache(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
|
@ -2221,18 +2222,18 @@ def undoLikesCollectionEntry(recent_posts_cache: {},
|
||||||
# remove any cached version of this post so that the
|
# remove any cached version of this post so that the
|
||||||
# like icon is changed
|
# like icon is changed
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
cachedPostFilename = \
|
cached_post_filename = \
|
||||||
get_cached_post_filename(base_dir, nickname,
|
get_cached_post_filename(base_dir, nickname,
|
||||||
domain, post_json_object)
|
domain, post_json_object)
|
||||||
if cachedPostFilename:
|
if cached_post_filename:
|
||||||
if os.path.isfile(cachedPostFilename):
|
if os.path.isfile(cached_post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(cachedPostFilename)
|
os.remove(cached_post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: undoLikesCollectionEntry ' +
|
print('EX: undoLikesCollectionEntry ' +
|
||||||
'unable to delete cached post ' +
|
'unable to delete cached post ' +
|
||||||
str(cachedPostFilename))
|
str(cached_post_filename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
if not post_json_object.get('type'):
|
if not post_json_object.get('type'):
|
||||||
return
|
return
|
||||||
|
@ -2287,18 +2288,18 @@ def undoReactionCollectionEntry(recent_posts_cache: {},
|
||||||
# remove any cached version of this post so that the
|
# remove any cached version of this post so that the
|
||||||
# like icon is changed
|
# like icon is changed
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
cachedPostFilename = \
|
cached_post_filename = \
|
||||||
get_cached_post_filename(base_dir, nickname,
|
get_cached_post_filename(base_dir, nickname,
|
||||||
domain, post_json_object)
|
domain, post_json_object)
|
||||||
if cachedPostFilename:
|
if cached_post_filename:
|
||||||
if os.path.isfile(cachedPostFilename):
|
if os.path.isfile(cached_post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(cachedPostFilename)
|
os.remove(cached_post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: undoReactionCollectionEntry ' +
|
print('EX: undoReactionCollectionEntry ' +
|
||||||
'unable to delete cached post ' +
|
'unable to delete cached post ' +
|
||||||
str(cachedPostFilename))
|
str(cached_post_filename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
if not post_json_object.get('type'):
|
if not post_json_object.get('type'):
|
||||||
return
|
return
|
||||||
|
@ -2354,19 +2355,19 @@ def undo_announce_collection_entry(recent_posts_cache: {},
|
||||||
# remove any cached version of this announce so that the announce
|
# remove any cached version of this announce so that the announce
|
||||||
# icon is changed
|
# icon is changed
|
||||||
nickname = getNicknameFromActor(actor)
|
nickname = getNicknameFromActor(actor)
|
||||||
cachedPostFilename = \
|
cached_post_filename = \
|
||||||
get_cached_post_filename(base_dir, nickname, domain,
|
get_cached_post_filename(base_dir, nickname, domain,
|
||||||
post_json_object)
|
post_json_object)
|
||||||
if cachedPostFilename:
|
if cached_post_filename:
|
||||||
if os.path.isfile(cachedPostFilename):
|
if os.path.isfile(cached_post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(cachedPostFilename)
|
os.remove(cached_post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
if debug:
|
if debug:
|
||||||
print('EX: undo_announce_collection_entry ' +
|
print('EX: undo_announce_collection_entry ' +
|
||||||
'unable to delete cached post ' +
|
'unable to delete cached post ' +
|
||||||
str(cachedPostFilename))
|
str(cached_post_filename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
if not post_json_object.get('type'):
|
if not post_json_object.get('type'):
|
||||||
return
|
return
|
||||||
|
@ -2422,19 +2423,19 @@ def update_announce_collection(recent_posts_cache: {},
|
||||||
return
|
return
|
||||||
# remove any cached version of this announce so that the announce
|
# remove any cached version of this announce so that the announce
|
||||||
# icon is changed
|
# icon is changed
|
||||||
cachedPostFilename = \
|
cached_post_filename = \
|
||||||
get_cached_post_filename(base_dir, nickname, domain,
|
get_cached_post_filename(base_dir, nickname, domain,
|
||||||
post_json_object)
|
post_json_object)
|
||||||
if cachedPostFilename:
|
if cached_post_filename:
|
||||||
if os.path.isfile(cachedPostFilename):
|
if os.path.isfile(cached_post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(cachedPostFilename)
|
os.remove(cached_post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
if debug:
|
if debug:
|
||||||
print('EX: update_announce_collection ' +
|
print('EX: update_announce_collection ' +
|
||||||
'unable to delete cached post ' +
|
'unable to delete cached post ' +
|
||||||
str(cachedPostFilename))
|
str(cached_post_filename))
|
||||||
removePostFromCache(post_json_object, recent_posts_cache)
|
remove_post_from_cache(post_json_object, recent_posts_cache)
|
||||||
|
|
||||||
if not has_object_dict(post_json_object):
|
if not has_object_dict(post_json_object):
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in New Issue