Snake case

main
Bob Mottram 2021-12-26 13:27:57 +00:00
parent 19e1bd2542
commit af628d051c
8 changed files with 20 additions and 20 deletions

View File

@ -274,7 +274,7 @@ from utils import get_locked_account
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 removeHtml from utils import removeHtml
from utils import isEditor from utils import is_editor
from utils import isArtist from utils import isArtist
from utils import getImageExtensions from utils import getImageExtensions
from utils import mediaFileMimeType from utils import mediaFileMimeType
@ -4075,7 +4075,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actorStr) nickname = getNicknameFromActor(actorStr)
editor = None editor = None
if nickname: if nickname:
editor = isEditor(base_dir, nickname) editor = is_editor(base_dir, nickname)
if not nickname or not editor: if not nickname or not editor:
if not nickname: if not nickname:
print('WARN: nickname not found in ' + actorStr) print('WARN: nickname not found in ' + actorStr)
@ -4234,7 +4234,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actorStr) nickname = getNicknameFromActor(actorStr)
editor = None editor = None
if nickname: if nickname:
editor = isEditor(base_dir, nickname) editor = is_editor(base_dir, nickname)
if not hashtag or not editor: if not hashtag or not editor:
if not nickname: if not nickname:
print('WARN: nickname not found in ' + actorStr) print('WARN: nickname not found in ' + actorStr)
@ -4562,7 +4562,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname = getNicknameFromActor(actorStr) nickname = getNicknameFromActor(actorStr)
editorRole = None editorRole = None
if nickname: if nickname:
editorRole = isEditor(base_dir, nickname) editorRole = is_editor(base_dir, nickname)
if not nickname or not editorRole: if not nickname or not editorRole:
if not nickname: if not nickname:
print('WARN: nickname not found in ' + actorStr) print('WARN: nickname not found in ' + actorStr)
@ -10954,7 +10954,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/' in currNickname: if '/' in currNickname:
currNickname = currNickname.split('/')[0] currNickname = currNickname.split('/')[0]
moderator = isModerator(base_dir, currNickname) moderator = isModerator(base_dir, currNickname)
editor = isEditor(base_dir, currNickname) editor = is_editor(base_dir, currNickname)
artist = isArtist(base_dir, currNickname) artist = isArtist(base_dir, currNickname)
full_width_tl_button_header = \ full_width_tl_button_header = \
self.server.full_width_tl_button_header self.server.full_width_tl_button_header

View File

@ -286,7 +286,7 @@ def is_dormant(base_dir: str, nickname: str, domain: str, actor: str,
return False return False
def isEditor(base_dir: str, nickname: str) -> bool: def is_editor(base_dir: str, nickname: str) -> bool:
"""Returns true if the given nickname is an editor """Returns true if the given nickname is an editor
""" """
editorsFile = base_dir + '/accounts/editors.txt' editorsFile = base_dir + '/accounts/editors.txt'

View File

@ -10,7 +10,7 @@ __module_group__ = "Web Interface Columns"
import os import os
from utils import getConfigParam from utils import getConfigParam
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import isEditor from utils import is_editor
from utils import isArtist from utils import isArtist
from utils import removeDomainPort from utils import removeDomainPort
from utils import local_actor_url from utils import local_actor_url
@ -371,7 +371,7 @@ def htmlLinksMobile(cssCache: {}, base_dir: str,
editor = False editor = False
artist = False artist = False
else: else:
editor = isEditor(base_dir, nickname) editor = is_editor(base_dir, nickname)
artist = isArtist(base_dir, nickname) artist = isArtist(base_dir, nickname)
domain = removeDomainPort(domain_full) domain = removeDomainPort(domain_full)
@ -429,7 +429,7 @@ def htmlEditLinks(cssCache: {}, translate: {}, base_dir: str, path: str,
return '' return ''
# is the user a moderator? # is the user a moderator?
if not isEditor(base_dir, nickname): if not is_editor(base_dir, nickname):
return '' return ''
cssFilename = base_dir + '/epicyon-links.css' cssFilename = base_dir + '/epicyon-links.css'

View File

@ -18,7 +18,7 @@ from utils import locatePost
from utils import loadJson from utils import loadJson
from utils import votesOnNewswireItem from utils import votesOnNewswireItem
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import isEditor from utils import is_editor
from utils import getConfigParam from utils import getConfigParam
from utils import removeDomainPort from utils import removeDomainPort
from utils import acct_dir from utils import acct_dir
@ -474,7 +474,7 @@ def htmlNewswireMobile(cssCache: {}, base_dir: str, nickname: str,
moderator = isModerator(base_dir, nickname) moderator = isModerator(base_dir, nickname)
# is the user a site editor? # is the user a site editor?
editor = isEditor(base_dir, nickname) editor = is_editor(base_dir, nickname)
showPublishButton = editor showPublishButton = editor
@ -655,7 +655,7 @@ def htmlEditNewsPost(cssCache: {}, translate: {}, base_dir: str, path: str,
return '' return ''
# is the user an editor? # is the user an editor?
if not isEditor(base_dir, nickname): if not is_editor(base_dir, nickname):
return '' return ''
postUrl = postUrl.replace('/', '#') postUrl = postUrl.replace('/', '#')

View File

@ -11,7 +11,7 @@ import os
from utils import isArtist from utils import isArtist
from utils import isAccountDir from utils import isAccountDir
from utils import get_full_domain from utils import get_full_domain
from utils import isEditor from utils import is_editor
from utils import loadJson from utils import loadJson
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import getDomainFromActor from utils import getDomainFromActor
@ -344,7 +344,7 @@ def htmlModerationInfo(cssCache: {}, translate: {},
infoForm += '<b><u>' + acctNickname + '</u></b>' infoForm += '<b><u>' + acctNickname + '</u></b>'
else: else:
infoForm += acctNickname infoForm += acctNickname
if isEditor(base_dir, acctNickname): if is_editor(base_dir, acctNickname):
infoForm += '' infoForm += ''
infoForm += '</center></a>\n</td>\n' infoForm += '</center></a>\n</td>\n'
col += 1 col += 1

View File

@ -36,7 +36,7 @@ from utils import rejectPostId
from utils import isRecentPost from utils import isRecentPost
from utils import getConfigParam from utils import getConfigParam
from utils import get_full_domain from utils import get_full_domain
from utils import isEditor from utils import is_editor
from utils import locatePost from utils import locatePost
from utils import loadJson from utils import loadJson
from utils import getCachedPostDirectory from utils import getCachedPostDirectory
@ -472,7 +472,7 @@ def _getEditIconHtml(base_dir: str, nickname: str, domain_full: str,
# _addBlogsToNewswire) in which case anyone with # _addBlogsToNewswire) in which case anyone with
# editor status should be able to alter it # editor status should be able to alter it
if (actor.endswith('/' + domain_full + '/users/' + nickname) or if (actor.endswith('/' + domain_full + '/users/' + nickname) or
(isEditor(base_dir, nickname) and (is_editor(base_dir, nickname) and
actor.endswith('/' + domain_full + '/users/news'))): actor.endswith('/' + domain_full + '/users/news'))):
postId = removeIdEnding(post_json_object['object']['id']) postId = removeIdEnding(post_json_object['object']['id'])

View File

@ -15,7 +15,7 @@ from utils import get_base_content_from_post
from utils import isAccountDir from utils import isAccountDir
from utils import getConfigParam from utils import getConfigParam
from utils import get_full_domain from utils import get_full_domain
from utils import isEditor from utils import is_editor
from utils import loadJson from utils import loadJson
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
@ -785,7 +785,7 @@ def htmlHashtagSearch(cssCache: {},
'icons/logorss.png" /></a></center>\n' 'icons/logorss.png" /></a></center>\n'
# edit the category for this hashtag # edit the category for this hashtag
if isEditor(base_dir, nickname): if is_editor(base_dir, nickname):
category = getHashtagCategory(base_dir, hashtag) category = getHashtagCategory(base_dir, hashtag)
hashtagSearchForm += '<div class="hashtagCategoryContainer">\n' hashtagSearchForm += '<div class="hashtagCategoryContainer">\n'
hashtagSearchForm += ' <form enctype="multipart/form-data" ' + \ hashtagSearchForm += ' <form enctype="multipart/form-data" ' + \

View File

@ -14,7 +14,7 @@ from utils import isArtist
from utils import dangerousMarkup from utils import dangerousMarkup
from utils import getConfigParam from utils import getConfigParam
from utils import get_full_domain from utils import get_full_domain
from utils import isEditor from utils import is_editor
from utils import removeIdEnding from utils import removeIdEnding
from utils import acct_dir from utils import acct_dir
from utils import isfloat from utils import isfloat
@ -547,7 +547,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# is the user a site editor? # is the user a site editor?
if not editor: if not editor:
editor = isEditor(base_dir, nickname) editor = is_editor(base_dir, nickname)
_logTimelineTiming(enableTimingLog, timelineStartTime, boxName, '2') _logTimelineTiming(enableTimingLog, timelineStartTime, boxName, '2')