Snake case

main
Bob Mottram 2021-12-25 20:25:07 +00:00
parent 7e153c12b9
commit 03c2e4168c
5 changed files with 46 additions and 46 deletions

View File

@ -765,7 +765,7 @@ def htmlBlogView(authorized: bool,
return blogStr + htmlFooter() return blogStr + htmlFooter()
def htmlEditBlog(mediaInstance: bool, translate: {}, def htmlEditBlog(media_instance: bool, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
path: str, path: str,
pageNumber: int, pageNumber: int,
@ -878,7 +878,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
editBlogForm += ' <input type="submit" name="submitPost" value="' + \ editBlogForm += ' <input type="submit" name="submitPost" value="' + \
translate['Submit'] + '">' translate['Submit'] + '">'
editBlogForm += ' </center></div>' editBlogForm += ' </center></div>'
if mediaInstance: if media_instance:
editBlogForm += editBlogImageSection editBlogForm += editBlogImageSection
editBlogForm += \ editBlogForm += \
' <label class="labels">' + placeholderSubject + '</label><br>' ' <label class="labels">' + placeholderSubject + '</label><br>'
@ -898,7 +898,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
editTextArea(placeholderMessage, 'message', contentStr, editTextArea(placeholderMessage, 'message', contentStr,
messageBoxHeight, '', True) messageBoxHeight, '', True)
editBlogForm += dateAndLocation editBlogForm += dateAndLocation
if not mediaInstance: if not media_instance:
editBlogForm += editBlogImageSection editBlogForm += editBlogImageSection
editBlogForm += ' </div>' editBlogForm += ' </div>'
editBlogForm += '</form>' editBlogForm += '</form>'

View File

@ -5039,17 +5039,17 @@ class PubServer(BaseHTTPRequestHandler):
if nickname == adminNickname: if nickname == adminNickname:
# change media instance status # change media instance status
if fields.get('mediaInstance'): if fields.get('media_instance'):
self.server.mediaInstance = False self.server.media_instance = False
self.server.defaultTimeline = 'inbox' self.server.defaultTimeline = 'inbox'
if fields['mediaInstance'] == 'on': if fields['media_instance'] == 'on':
self.server.mediaInstance = True self.server.media_instance = True
self.server.blogs_instance = False self.server.blogs_instance = False
self.server.news_instance = False self.server.news_instance = False
self.server.defaultTimeline = 'tlmedia' self.server.defaultTimeline = 'tlmedia'
setConfigParam(base_dir, setConfigParam(base_dir,
"mediaInstance", "media_instance",
self.server.mediaInstance) self.server.media_instance)
setConfigParam(base_dir, setConfigParam(base_dir,
"blogs_instance", "blogs_instance",
self.server.blogs_instance) self.server.blogs_instance)
@ -5057,12 +5057,12 @@ class PubServer(BaseHTTPRequestHandler):
"news_instance", "news_instance",
self.server.news_instance) self.server.news_instance)
else: else:
if self.server.mediaInstance: if self.server.media_instance:
self.server.mediaInstance = False self.server.media_instance = False
self.server.defaultTimeline = 'inbox' self.server.defaultTimeline = 'inbox'
setConfigParam(base_dir, setConfigParam(base_dir,
"mediaInstance", "media_instance",
self.server.mediaInstance) self.server.media_instance)
# is this a news theme? # is this a news theme?
if isNewsThemeName(self.server.base_dir, if isNewsThemeName(self.server.base_dir,
@ -5076,11 +5076,11 @@ class PubServer(BaseHTTPRequestHandler):
if fields['news_instance'] == 'on': if fields['news_instance'] == 'on':
self.server.news_instance = True self.server.news_instance = True
self.server.blogs_instance = False self.server.blogs_instance = False
self.server.mediaInstance = False self.server.media_instance = False
self.server.defaultTimeline = 'tlfeatures' self.server.defaultTimeline = 'tlfeatures'
setConfigParam(base_dir, setConfigParam(base_dir,
"mediaInstance", "media_instance",
self.server.mediaInstance) self.server.media_instance)
setConfigParam(base_dir, setConfigParam(base_dir,
"blogs_instance", "blogs_instance",
self.server.blogs_instance) self.server.blogs_instance)
@ -5093,7 +5093,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline = 'inbox' self.server.defaultTimeline = 'inbox'
setConfigParam(base_dir, setConfigParam(base_dir,
"news_instance", "news_instance",
self.server.mediaInstance) self.server.media_instance)
# change blog instance status # change blog instance status
if fields.get('blogs_instance'): if fields.get('blogs_instance'):
@ -5101,15 +5101,15 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline = 'inbox' self.server.defaultTimeline = 'inbox'
if fields['blogs_instance'] == 'on': if fields['blogs_instance'] == 'on':
self.server.blogs_instance = True self.server.blogs_instance = True
self.server.mediaInstance = False self.server.media_instance = False
self.server.news_instance = False self.server.news_instance = False
self.server.defaultTimeline = 'tlblogs' self.server.defaultTimeline = 'tlblogs'
setConfigParam(base_dir, setConfigParam(base_dir,
"blogs_instance", "blogs_instance",
self.server.blogs_instance) self.server.blogs_instance)
setConfigParam(base_dir, setConfigParam(base_dir,
"mediaInstance", "media_instance",
self.server.mediaInstance) self.server.media_instance)
setConfigParam(base_dir, setConfigParam(base_dir,
"news_instance", "news_instance",
self.server.news_instance) self.server.news_instance)
@ -12907,7 +12907,7 @@ class PubServer(BaseHTTPRequestHandler):
return True return True
def _showNewPost(self, callingDomain: str, path: str, def _showNewPost(self, callingDomain: str, path: str,
mediaInstance: bool, translate: {}, media_instance: bool, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
inReplyToUrl: str, replyToList: [], inReplyToUrl: str, replyToList: [],
shareDescription: str, replyPageNumber: int, shareDescription: str, replyPageNumber: int,
@ -12954,7 +12954,7 @@ class PubServer(BaseHTTPRequestHandler):
postJsonObject = loadJson(replyPostFilename) postJsonObject = loadJson(replyPostFilename)
msg = htmlNewPost(self.server.cssCache, msg = htmlNewPost(self.server.cssCache,
mediaInstance, media_instance,
translate, translate,
base_dir, base_dir,
http_prefix, http_prefix,
@ -15078,13 +15078,13 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, nickname) self.server.domain, nickname)
setMinimal(self.server.base_dir, setMinimal(self.server.base_dir,
self.server.domain, nickname, notMin) self.server.domain, nickname, notMin)
if not (self.server.mediaInstance or if not (self.server.media_instance or
self.server.blogs_instance): self.server.blogs_instance):
self.path = '/users/' + nickname + '/inbox' self.path = '/users/' + nickname + '/inbox'
else: else:
if self.server.blogs_instance: if self.server.blogs_instance:
self.path = '/users/' + nickname + '/tlblogs' self.path = '/users/' + nickname + '/tlblogs'
elif self.server.mediaInstance: elif self.server.media_instance:
self.path = '/users/' + nickname + '/tlmedia' self.path = '/users/' + nickname + '/tlmedia'
else: else:
self.path = '/users/' + nickname + '/tlfeatures' self.path = '/users/' + nickname + '/tlfeatures'
@ -15676,7 +15676,7 @@ class PubServer(BaseHTTPRequestHandler):
localActorUrl(self.server.http_prefix, nickname, localActorUrl(self.server.http_prefix, nickname,
self.server.domainFull) + \ self.server.domainFull) + \
'/statuses/' + messageId '/statuses/' + messageId
msg = htmlEditBlog(self.server.mediaInstance, msg = htmlEditBlog(self.server.media_instance,
self.server.translate, self.server.translate,
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
@ -15747,7 +15747,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
if self._showNewPost(callingDomain, self.path, if self._showNewPost(callingDomain, self.path,
self.server.mediaInstance, self.server.media_instance,
self.server.translate, self.server.translate,
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
@ -18451,7 +18451,7 @@ def runDaemon(content_license_url: str,
newswire_votes_threshold: int, newswire_votes_threshold: int,
news_instance: bool, news_instance: bool,
blogs_instance: bool, blogs_instance: bool,
mediaInstance: bool, media_instance: bool,
maxRecentPosts: int, maxRecentPosts: int,
enableSharedInbox: bool, registration: bool, enableSharedInbox: bool, registration: bool,
language: str, projectVersion: str, language: str, projectVersion: str,
@ -18607,7 +18607,7 @@ def runDaemon(content_license_url: str,
httpd.manualFollowerApproval = manualFollowerApproval httpd.manualFollowerApproval = manualFollowerApproval
httpd.onionDomain = onionDomain httpd.onionDomain = onionDomain
httpd.i2pDomain = i2pDomain httpd.i2pDomain = i2pDomain
httpd.mediaInstance = mediaInstance httpd.media_instance = media_instance
httpd.blogs_instance = blogs_instance httpd.blogs_instance = blogs_instance
# load translations dictionary # load translations dictionary
@ -18807,7 +18807,7 @@ def runDaemon(content_license_url: str,
httpd.news_instance = news_instance httpd.news_instance = news_instance
httpd.defaultTimeline = 'inbox' httpd.defaultTimeline = 'inbox'
if mediaInstance: if media_instance:
httpd.defaultTimeline = 'tlmedia' httpd.defaultTimeline = 'tlmedia'
if blogs_instance: if blogs_instance:
httpd.defaultTimeline = 'tlblogs' httpd.defaultTimeline = 'tlblogs'

View File

@ -998,9 +998,9 @@ if not themeName:
themeName = 'default' themeName = 'default'
if not args.mediainstance: if not args.mediainstance:
mediaInstance = getConfigParam(base_dir, 'mediaInstance') media_instance = getConfigParam(base_dir, 'media_instance')
if mediaInstance is not None: if media_instance is not None:
args.mediainstance = mediaInstance args.mediainstance = media_instance
if args.mediainstance: if args.mediainstance:
args.blogsinstance = False args.blogsinstance = False
args.newsinstance = False args.newsinstance = False

View File

@ -184,7 +184,7 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
return dropDownContent return dropDownContent
def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
path: str, inReplyTo: str, path: str, inReplyTo: str,
mentions: [], mentions: [],
@ -779,7 +779,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
newPostForm += ' </center></div>\n' newPostForm += ' </center></div>\n'
newPostForm += replyStr newPostForm += replyStr
if mediaInstance and not replyStr: if media_instance and not replyStr:
newPostForm += newPostImageSection newPostForm += newPostImageSection
if not shareDescription: if not shareDescription:
@ -818,7 +818,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
newPostForm += \ newPostForm += \
' <br><label class="labels">' + placeholderMessage + '</label>' ' <br><label class="labels">' + placeholderMessage + '</label>'
if mediaInstance: if media_instance:
messageBoxHeight = 200 messageBoxHeight = 200
if endpoint == 'newquestion': if endpoint == 'newquestion':
@ -832,7 +832,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
' spellcheck="true" autocomplete="on">' + \ ' spellcheck="true" autocomplete="on">' + \
'</textarea>\n' '</textarea>\n'
newPostForm += extraFields + citationsStr + dateAndLocation newPostForm += extraFields + citationsStr + dateAndLocation
if not mediaInstance or replyStr: if not media_instance or replyStr:
newPostForm += newPostImageSection newPostForm += newPostImageSection
newPostForm += \ newPostForm += \

View File

@ -1296,7 +1296,7 @@ def _htmlEditProfileTwitter(base_dir: str, translate: {},
def _htmlEditProfileInstance(base_dir: str, translate: {}, def _htmlEditProfileInstance(base_dir: str, translate: {},
peertubeInstances: [], peertubeInstances: [],
mediaInstanceStr: str, media_instanceStr: str,
blogs_instanceStr: str, blogs_instanceStr: str,
news_instanceStr: str) -> (str, str, str, str): news_instanceStr: str) -> (str, str, str, str):
"""Edit profile instance settings """Edit profile instance settings
@ -1387,7 +1387,7 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
translate['Type of instance'] + '</label><br>\n' translate['Type of instance'] + '</label><br>\n'
instanceStr += \ instanceStr += \
editCheckBox(translate['This is a media instance'], editCheckBox(translate['This is a media instance'],
'mediaInstance', mediaInstanceStr) 'media_instance', media_instanceStr)
instanceStr += \ instanceStr += \
editCheckBox(translate['This is a blogging instance'], editCheckBox(translate['This is a blogging instance'],
'blogs_instance', blogs_instanceStr) 'blogs_instance', blogs_instanceStr)
@ -2112,7 +2112,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
displayNickname = nickname displayNickname = nickname
isBot = isGroup = followDMs = removeTwitter = '' isBot = isGroup = followDMs = removeTwitter = ''
notifyLikes = notifyReactions = '' notifyLikes = notifyReactions = ''
hideLikeButton = hideReactionButton = mediaInstanceStr = '' hideLikeButton = hideReactionButton = media_instanceStr = ''
blogs_instanceStr = news_instanceStr = movedTo = twitterStr = '' blogs_instanceStr = news_instanceStr = movedTo = twitterStr = ''
bioStr = donateUrl = websiteUrl = emailAddress = '' bioStr = donateUrl = websiteUrl = emailAddress = ''
PGPpubKey = EnigmaPubKey = '' PGPpubKey = EnigmaPubKey = ''
@ -2172,23 +2172,23 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
if os.path.isfile(accountDir + '/.hideReactionButton'): if os.path.isfile(accountDir + '/.hideReactionButton'):
hideReactionButton = 'checked' hideReactionButton = 'checked'
mediaInstance = getConfigParam(base_dir, "mediaInstance") media_instance = getConfigParam(base_dir, "media_instance")
if mediaInstance: if media_instance:
if mediaInstance is True: if media_instance is True:
mediaInstanceStr = 'checked' media_instanceStr = 'checked'
blogs_instanceStr = news_instanceStr = '' blogs_instanceStr = news_instanceStr = ''
news_instance = getConfigParam(base_dir, "news_instance") news_instance = getConfigParam(base_dir, "news_instance")
if news_instance: if news_instance:
if news_instance is True: if news_instance is True:
news_instanceStr = 'checked' news_instanceStr = 'checked'
blogs_instanceStr = mediaInstanceStr = '' blogs_instanceStr = media_instanceStr = ''
blogs_instance = getConfigParam(base_dir, "blogs_instance") blogs_instance = getConfigParam(base_dir, "blogs_instance")
if blogs_instance: if blogs_instance:
if blogs_instance is True: if blogs_instance is True:
blogs_instanceStr = 'checked' blogs_instanceStr = 'checked'
mediaInstanceStr = news_instanceStr = '' media_instanceStr = news_instanceStr = ''
cssFilename = base_dir + '/epicyon-profile.css' cssFilename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
@ -2221,7 +2221,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
instanceStr, roleAssignStr, peertubeStr, libretranslateStr = \ instanceStr, roleAssignStr, peertubeStr, libretranslateStr = \
_htmlEditProfileInstance(base_dir, translate, _htmlEditProfileInstance(base_dir, translate,
peertubeInstances, peertubeInstances,
mediaInstanceStr, media_instanceStr,
blogs_instanceStr, blogs_instanceStr,
news_instanceStr) news_instanceStr)
systemMonitorStr = _htmlSystemMonitor(nickname, translate) systemMonitorStr = _htmlSystemMonitor(nickname, translate)