mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
e31a7a7679
commit
50ce448667
|
@ -288,7 +288,7 @@ from utils import get_config_param
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import undo_likes_collection_entry
|
from utils import undo_likes_collection_entry
|
||||||
from utils import deletePost
|
from utils import deletePost
|
||||||
from utils import isBlogPost
|
from utils import is_blog_post
|
||||||
from utils import remove_avatar_from_cache
|
from utils import remove_avatar_from_cache
|
||||||
from utils import locate_post
|
from utils import locate_post
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
|
@ -14175,7 +14175,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.path)
|
self.path)
|
||||||
if blogFilename and nickname:
|
if blogFilename and nickname:
|
||||||
post_json_object = load_json(blogFilename)
|
post_json_object = load_json(blogFilename)
|
||||||
if isBlogPost(post_json_object):
|
if is_blog_post(post_json_object):
|
||||||
msg = htmlBlogPost(self.server.session,
|
msg = htmlBlogPost(self.server.session,
|
||||||
authorized,
|
authorized,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
|
|
4
inbox.py
4
inbox.py
|
@ -41,7 +41,7 @@ from utils import valid_post_date
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import get_protocol_prefixes
|
from utils import get_protocol_prefixes
|
||||||
from utils import isBlogPost
|
from utils import is_blog_post
|
||||||
from utils import remove_avatar_from_cache
|
from utils import remove_avatar_from_cache
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
|
@ -3522,7 +3522,7 @@ def _inboxAfterInitial(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
domain_full, person_cache, signing_priv_key_pem):
|
domain_full, person_cache, signing_priv_key_pem):
|
||||||
# media index will be updated
|
# media index will be updated
|
||||||
updateIndexList.append('tlmedia')
|
updateIndexList.append('tlmedia')
|
||||||
if isBlogPost(post_json_object):
|
if is_blog_post(post_json_object):
|
||||||
# blogs index will be updated
|
# blogs index will be updated
|
||||||
updateIndexList.append('tlblogs')
|
updateIndexList.append('tlblogs')
|
||||||
|
|
||||||
|
|
|
@ -966,7 +966,7 @@ def _isNewswireBlogPost(post_json_object: {}) -> bool:
|
||||||
"""Is the given object a blog post?
|
"""Is the given object a blog post?
|
||||||
There isn't any difference between a blog post and a newswire blog post
|
There isn't any difference between a blog post and a newswire blog post
|
||||||
but we may here need to check for different properties than
|
but we may here need to check for different properties than
|
||||||
isBlogPost does
|
is_blog_post does
|
||||||
"""
|
"""
|
||||||
if not post_json_object:
|
if not post_json_object:
|
||||||
return False
|
return False
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -1461,8 +1461,8 @@ def can_reply_to(base_dir: str, nickname: str, domain: str,
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _removeAttachment(base_dir: str, http_prefix: str, domain: str,
|
def _remove_attachment(base_dir: str, http_prefix: str, domain: str,
|
||||||
post_json: {}):
|
post_json: {}):
|
||||||
if not post_json.get('attachment'):
|
if not post_json.get('attachment'):
|
||||||
return
|
return
|
||||||
if not post_json['attachment'][0].get('url'):
|
if not post_json['attachment'][0].get('url'):
|
||||||
|
@ -1476,14 +1476,14 @@ def _removeAttachment(base_dir: str, http_prefix: str, domain: str,
|
||||||
try:
|
try:
|
||||||
os.remove(media_filename)
|
os.remove(media_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: _removeAttachment unable to delete media file ' +
|
print('EX: _remove_attachment unable to delete media file ' +
|
||||||
str(media_filename))
|
str(media_filename))
|
||||||
etag_filename = media_filename + '.etag'
|
etag_filename = media_filename + '.etag'
|
||||||
if os.path.isfile(etag_filename):
|
if os.path.isfile(etag_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(etag_filename)
|
os.remove(etag_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: _removeAttachment unable to delete etag file ' +
|
print('EX: _remove_attachment unable to delete etag file ' +
|
||||||
str(etag_filename))
|
str(etag_filename))
|
||||||
post_json['attachment'] = []
|
post_json['attachment'] = []
|
||||||
|
|
||||||
|
@ -1752,7 +1752,7 @@ def deletePost(base_dir: str, http_prefix: str,
|
||||||
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
|
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
|
||||||
|
|
||||||
# remove any attachment
|
# remove any attachment
|
||||||
_removeAttachment(base_dir, http_prefix, domain, post_json_object)
|
_remove_attachment(base_dir, http_prefix, domain, post_json_object)
|
||||||
|
|
||||||
extensions = ('votes', 'arrived', 'muted', 'tts', 'reject')
|
extensions = ('votes', 'arrived', 'muted', 'tts', 'reject')
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
|
@ -2084,7 +2084,7 @@ def getCSS(base_dir: str, css_filename: str, cssCache: {}) -> str:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def isBlogPost(post_json_object: {}) -> bool:
|
def is_blog_post(post_json_object: {}) -> bool:
|
||||||
"""Is the given post a blog post?
|
"""Is the given post a blog post?
|
||||||
"""
|
"""
|
||||||
if post_json_object['type'] != 'Create':
|
if post_json_object['type'] != 'Create':
|
||||||
|
|
|
@ -43,7 +43,7 @@ from utils import get_cached_post_directory
|
||||||
from utils import get_cached_post_filename
|
from utils import get_cached_post_filename
|
||||||
from utils import get_protocol_prefixes
|
from utils import get_protocol_prefixes
|
||||||
from utils import is_news_post
|
from utils import is_news_post
|
||||||
from utils import isBlogPost
|
from utils import is_blog_post
|
||||||
from utils import get_display_name
|
from utils import get_display_name
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import updateRecentPostsCache
|
from utils import updateRecentPostsCache
|
||||||
|
@ -480,7 +480,7 @@ def _getEditIconHtml(base_dir: str, nickname: str, domain_full: str,
|
||||||
if '/statuses/' not in post_id:
|
if '/statuses/' not in post_id:
|
||||||
return editStr
|
return editStr
|
||||||
|
|
||||||
if isBlogPost(post_json_object):
|
if is_blog_post(post_json_object):
|
||||||
editBlogPostStr = 'Edit blog post'
|
editBlogPostStr = 'Edit blog post'
|
||||||
if translate.get(editBlogPostStr):
|
if translate.get(editBlogPostStr):
|
||||||
editBlogPostStr = translate[editBlogPostStr]
|
editBlogPostStr = translate[editBlogPostStr]
|
||||||
|
@ -1788,7 +1788,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
|
|
||||||
publishedLink = messageId
|
publishedLink = messageId
|
||||||
# blog posts should have no /statuses/ in their link
|
# blog posts should have no /statuses/ in their link
|
||||||
if isBlogPost(post_json_object):
|
if is_blog_post(post_json_object):
|
||||||
# is this a post to the local domain?
|
# is this a post to the local domain?
|
||||||
if '://' + domain in messageId:
|
if '://' + domain in messageId:
|
||||||
publishedLink = messageId.replace('/statuses/', '/')
|
publishedLink = messageId.replace('/statuses/', '/')
|
||||||
|
@ -1924,7 +1924,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
cwContentStr, post_json_object, pageNumber)
|
cwContentStr, post_json_object, pageNumber)
|
||||||
cwContentStr = \
|
cwContentStr = \
|
||||||
switchWords(base_dir, nickname, domain, cwContentStr)
|
switchWords(base_dir, nickname, domain, cwContentStr)
|
||||||
if not isBlogPost(post_json_object):
|
if not is_blog_post(post_json_object):
|
||||||
# get the content warning button
|
# get the content warning button
|
||||||
contentStr += \
|
contentStr += \
|
||||||
getContentWarningButton(postID, translate, cwContentStr)
|
getContentWarningButton(postID, translate, cwContentStr)
|
||||||
|
|
Loading…
Reference in New Issue