Snake case

main
Bob Mottram 2021-12-26 15:44:28 +00:00
parent c1034b21d1
commit 5254142511
3 changed files with 11 additions and 11 deletions

View File

@ -372,9 +372,9 @@ def get_image_mime_type(image_filename: str) -> str:
'webp': 'webp', 'webp': 'webp',
'ico': 'x-icon' 'ico': 'x-icon'
} }
for ext, mimeExt in extensionsToMime.items(): for ext, mime_ext in extensionsToMime.items():
if image_filename.endswith('.' + ext): if image_filename.endswith('.' + ext):
return 'image/' + mimeExt return 'image/' + mime_ext
return 'image/png' return 'image/png'
@ -403,7 +403,7 @@ def get_media_extensions() -> []:
get_video_extensions() + get_audio_extensions() get_video_extensions() + get_audio_extensions()
def getImageFormats() -> str: def get_image_formats() -> str:
"""Returns a string of permissable image formats """Returns a string of permissable image formats
used when selecting an image for a new post used when selecting an image for a new post
""" """
@ -430,10 +430,10 @@ def getMediaFormats() -> str:
"""Returns a string of permissable media formats """Returns a string of permissable media formats
used when selecting an attachment for a new post used when selecting an attachment for a new post
""" """
mediaExt = get_media_extensions() media_ext = get_media_extensions()
mediaFormats = '' mediaFormats = ''
for ext in mediaExt: for ext in media_ext:
if mediaFormats: if mediaFormats:
mediaFormats += ', ' mediaFormats += ', '
mediaFormats += '.' + ext mediaFormats += '.' + ext

View File

@ -24,7 +24,7 @@ from utils import isSystemAccount
from utils import removeHtml from utils import removeHtml
from utils import load_json from utils import load_json
from utils import get_config_param from utils import get_config_param
from utils import getImageFormats from utils import get_image_formats
from utils import acct_dir from utils import acct_dir
from utils import getSupportedLanguages from utils import getSupportedLanguages
from utils import local_actor_url from utils import local_actor_url
@ -1307,7 +1307,7 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
news_instanceStr: str) -> (str, str, str, str): news_instanceStr: str) -> (str, str, str, str):
"""Edit profile instance settings """Edit profile instance settings
""" """
imageFormats = getImageFormats() imageFormats = get_image_formats()
# Instance details section # Instance details section
instanceDescription = \ instanceDescription = \
@ -1838,7 +1838,7 @@ def _htmlEditProfileBackground(news_instance: bool, translate: {}) -> str:
' <label class="labels">' + translate[idx] + '</label><br><br>\n' ' <label class="labels">' + translate[idx] + '</label><br><br>\n'
if not news_instance: if not news_instance:
imageFormats = getImageFormats() imageFormats = get_image_formats()
editProfileForm += \ editProfileForm += \
' <label class="labels">' + \ ' <label class="labels">' + \
translate['Background image'] + '</label>\n' + \ translate['Background image'] + '</label>\n' + \
@ -1989,7 +1989,7 @@ def _htmlEditProfileMain(base_dir: str, displayNickname: str, bioStr: str,
translate: {}) -> str: translate: {}) -> str:
"""main info on edit profile screen """main info on edit profile screen
""" """
imageFormats = getImageFormats() imageFormats = get_image_formats()
editProfileForm = ' <div class="container">\n' editProfileForm = ' <div class="container">\n'

View File

@ -13,7 +13,7 @@ from utils import removeHtml
from utils import load_json from utils import load_json
from utils import get_config_param from utils import get_config_param
from utils import get_image_extensions from utils import get_image_extensions
from utils import getImageFormats from utils import get_image_formats
from utils import acct_dir from utils import acct_dir
from utils import local_actor_url from utils import local_actor_url
from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlHeaderWithExternalStyle
@ -78,7 +78,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
avatarUrl = \ avatarUrl = \
local_actor_url(http_prefix, nickname, domain_full) + '/avatar.' + ext local_actor_url(http_prefix, nickname, domain_full) + '/avatar.' + ext
imageFormats = getImageFormats() imageFormats = get_image_formats()
profileForm += '<div class="container">' + profileText + '</div>\n' profileForm += '<div class="container">' + profileText + '</div>\n'
profileForm += \ profileForm += \
'<form enctype="multipart/form-data" method="POST" ' + \ '<form enctype="multipart/form-data" method="POST" ' + \