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

View File

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

View File

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

View File

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

View File

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