Snake case

merge-requests/30/head
Bob Mottram 2021-12-28 13:49:44 +00:00
parent e31a7a7679
commit 50ce448667
5 changed files with 15 additions and 15 deletions

View File

@ -288,7 +288,7 @@ from utils import get_config_param
from utils import remove_id_ending
from utils import undo_likes_collection_entry
from utils import deletePost
from utils import isBlogPost
from utils import is_blog_post
from utils import remove_avatar_from_cache
from utils import locate_post
from utils import get_cached_post_filename
@ -14175,7 +14175,7 @@ class PubServer(BaseHTTPRequestHandler):
self.path)
if blogFilename and nickname:
post_json_object = load_json(blogFilename)
if isBlogPost(post_json_object):
if is_blog_post(post_json_object):
msg = htmlBlogPost(self.server.session,
authorized,
self.server.base_dir,

View File

@ -41,7 +41,7 @@ from utils import valid_post_date
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 is_blog_post
from utils import remove_avatar_from_cache
from utils import isPublicPost
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):
# media index will be updated
updateIndexList.append('tlmedia')
if isBlogPost(post_json_object):
if is_blog_post(post_json_object):
# blogs index will be updated
updateIndexList.append('tlblogs')

View File

@ -966,7 +966,7 @@ def _isNewswireBlogPost(post_json_object: {}) -> bool:
"""Is the given object a 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
isBlogPost does
is_blog_post does
"""
if not post_json_object:
return False

View File

@ -1461,7 +1461,7 @@ def can_reply_to(base_dir: str, nickname: str, domain: str,
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: {}):
if not post_json.get('attachment'):
return
@ -1476,14 +1476,14 @@ def _removeAttachment(base_dir: str, http_prefix: str, domain: str,
try:
os.remove(media_filename)
except OSError:
print('EX: _removeAttachment unable to delete media file ' +
print('EX: _remove_attachment unable to delete media file ' +
str(media_filename))
etag_filename = media_filename + '.etag'
if os.path.isfile(etag_filename):
try:
os.remove(etag_filename)
except OSError:
print('EX: _removeAttachment unable to delete etag file ' +
print('EX: _remove_attachment unable to delete etag file ' +
str(etag_filename))
post_json['attachment'] = []
@ -1752,7 +1752,7 @@ def deletePost(base_dir: str, http_prefix: str,
_deleteConversationPost(base_dir, nickname, domain, post_json_object)
# 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')
for ext in extensions:
@ -2084,7 +2084,7 @@ def getCSS(base_dir: str, css_filename: str, cssCache: {}) -> str:
return None
def isBlogPost(post_json_object: {}) -> bool:
def is_blog_post(post_json_object: {}) -> bool:
"""Is the given post a blog post?
"""
if post_json_object['type'] != 'Create':

View File

@ -43,7 +43,7 @@ from utils import get_cached_post_directory
from utils import get_cached_post_filename
from utils import get_protocol_prefixes
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 isPublicPost
from utils import updateRecentPostsCache
@ -480,7 +480,7 @@ def _getEditIconHtml(base_dir: str, nickname: str, domain_full: str,
if '/statuses/' not in post_id:
return editStr
if isBlogPost(post_json_object):
if is_blog_post(post_json_object):
editBlogPostStr = 'Edit blog post'
if translate.get(editBlogPostStr):
editBlogPostStr = translate[editBlogPostStr]
@ -1788,7 +1788,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
publishedLink = messageId
# 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?
if '://' + domain in messageId:
publishedLink = messageId.replace('/statuses/', '/')
@ -1924,7 +1924,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
cwContentStr, post_json_object, pageNumber)
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
contentStr += \
getContentWarningButton(postID, translate, cwContentStr)