mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
43f77c70ae
commit
47b844152e
|
@ -280,7 +280,7 @@ from utils import get_image_extensions
|
||||||
from utils import media_file_mime_type
|
from utils import media_file_mime_type
|
||||||
from utils import getCSS
|
from utils import getCSS
|
||||||
from utils import first_paragraph_from_string
|
from utils import first_paragraph_from_string
|
||||||
from utils import clearFromPostCaches
|
from utils import clear_from_post_caches
|
||||||
from utils import contains_invalid_chars
|
from utils import contains_invalid_chars
|
||||||
from utils import is_system_account
|
from utils import is_system_account
|
||||||
from utils import set_config_param
|
from utils import set_config_param
|
||||||
|
@ -4661,7 +4661,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# remove any previous cached news posts
|
# remove any previous cached news posts
|
||||||
newsId = remove_id_ending(post_json_object['object']['id'])
|
newsId = remove_id_ending(post_json_object['object']['id'])
|
||||||
newsId = newsId.replace('/', '#')
|
newsId = newsId.replace('/', '#')
|
||||||
clearFromPostCaches(base_dir,
|
clear_from_post_caches(base_dir,
|
||||||
self.server.recent_posts_cache,
|
self.server.recent_posts_cache,
|
||||||
newsId)
|
newsId)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ from utils import get_full_domain
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import get_status_number
|
from utils import get_status_number
|
||||||
from utils import clearFromPostCaches
|
from utils import clear_from_post_caches
|
||||||
from utils import dangerous_markup
|
from utils import dangerous_markup
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from inbox import storeHashTags
|
from inbox import storeHashTags
|
||||||
|
@ -730,7 +730,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||||
http_prefix, domain_full,
|
http_prefix, domain_full,
|
||||||
blog, translate)
|
blog, translate)
|
||||||
|
|
||||||
clearFromPostCaches(base_dir, recent_posts_cache, post_id)
|
clear_from_post_caches(base_dir, recent_posts_cache, post_id)
|
||||||
if save_json(blog, filename):
|
if save_json(blog, filename):
|
||||||
_updateFeedsOutboxIndex(base_dir, domain, post_id + '.json')
|
_updateFeedsOutboxIndex(base_dir, domain, post_id + '.json')
|
||||||
|
|
||||||
|
|
16
utils.py
16
utils.py
|
@ -1296,7 +1296,7 @@ def locate_news_arrival(base_dir: str, domain: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def clearFromPostCaches(base_dir: str, recent_posts_cache: {},
|
def clear_from_post_caches(base_dir: str, recent_posts_cache: {},
|
||||||
post_id: str) -> None:
|
post_id: str) -> None:
|
||||||
"""Clears cached html for the given post, so that edits
|
"""Clears cached html for the given post, so that edits
|
||||||
to news will appear
|
to news will appear
|
||||||
|
@ -1308,13 +1308,13 @@ def clearFromPostCaches(base_dir: str, recent_posts_cache: {},
|
||||||
continue
|
continue
|
||||||
if acct.startswith('inbox@'):
|
if acct.startswith('inbox@'):
|
||||||
continue
|
continue
|
||||||
cacheDir = os.path.join(base_dir + '/accounts', acct)
|
cache_dir = os.path.join(base_dir + '/accounts', acct)
|
||||||
post_filename = cacheDir + filename
|
post_filename = cache_dir + filename
|
||||||
if os.path.isfile(post_filename):
|
if os.path.isfile(post_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(post_filename)
|
os.remove(post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: clearFromPostCaches file not removed ' +
|
print('EX: clear_from_post_caches file not removed ' +
|
||||||
str(post_filename))
|
str(post_filename))
|
||||||
# if the post is in the recent posts cache then remove it
|
# if the post is in the recent posts cache then remove it
|
||||||
if recent_posts_cache.get('index'):
|
if recent_posts_cache.get('index'):
|
||||||
|
@ -1346,15 +1346,15 @@ def locate_post(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
# search boxes
|
# search boxes
|
||||||
boxes = ('inbox', 'outbox', 'tlblogs')
|
boxes = ('inbox', 'outbox', 'tlblogs')
|
||||||
accountDir = acct_dir(base_dir, nickname, domain) + '/'
|
account_dir = acct_dir(base_dir, nickname, domain) + '/'
|
||||||
for boxName in boxes:
|
for boxName in boxes:
|
||||||
post_filename = accountDir + boxName + '/' + postUrl
|
post_filename = account_dir + boxName + '/' + postUrl
|
||||||
if os.path.isfile(post_filename):
|
if os.path.isfile(post_filename):
|
||||||
return post_filename
|
return post_filename
|
||||||
|
|
||||||
# check news posts
|
# check news posts
|
||||||
accountDir = base_dir + '/accounts/news' + '@' + domain + '/'
|
account_dir = base_dir + '/accounts/news' + '@' + domain + '/'
|
||||||
post_filename = accountDir + 'outbox/' + postUrl
|
post_filename = account_dir + 'outbox/' + postUrl
|
||||||
if os.path.isfile(post_filename):
|
if os.path.isfile(post_filename):
|
||||||
return post_filename
|
return post_filename
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue