Snake case

main
Bob Mottram 2021-12-31 23:50:29 +00:00
parent 0a3d10b2ca
commit a687cee0d2
12 changed files with 319 additions and 314 deletions

544
daemon.py

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ def html_access_keys(css_cache: {}, base_dir: str,
nickname: str, domain: str, nickname: str, domain: str,
translate: {}, access_keys: {}, translate: {}, access_keys: {},
defaultAccessKeys: {}, defaultAccessKeys: {},
defaultTimeline: str) -> str: default_timeline: str) -> str:
"""Show and edit key shortcuts """Show and edit key shortcuts
""" """
access_keysFilename = \ access_keysFilename = \

View File

@ -356,7 +356,7 @@ def html_links_mobile(css_cache: {}, base_dir: str,
timelinePath: str, authorized: bool, timelinePath: str, authorized: bool,
rss_icon_at_top: bool, rss_icon_at_top: bool,
icons_as_buttons: bool, icons_as_buttons: bool,
defaultTimeline: str, default_timeline: str,
theme: str, access_keys: {}, theme: str, access_keys: {},
shared_items_federated_domains: []) -> str: shared_items_federated_domains: []) -> str:
"""Show the left column links within mobile view """Show the left column links within mobile view
@ -385,7 +385,7 @@ def html_links_mobile(css_cache: {}, base_dir: str,
banner_file, banner_filename = \ banner_file, banner_filename = \
get_banner_file(base_dir, nickname, domain, theme) get_banner_file(base_dir, nickname, domain, theme)
html_str += \ html_str += \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" ' + \ '<a href="/users/' + nickname + '/' + default_timeline + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">' + \ 'accesskey="' + access_keys['menuTimeline'] + '">' + \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'alt="' + translate['Switch to timeline view'] + '" ' + \ 'alt="' + translate['Switch to timeline view'] + '" ' + \
@ -418,7 +418,7 @@ def html_links_mobile(css_cache: {}, base_dir: str,
def html_edit_links(css_cache: {}, translate: {}, base_dir: str, path: str, def html_edit_links(css_cache: {}, translate: {}, base_dir: str, path: str,
domain: str, port: int, http_prefix: str, domain: str, port: int, http_prefix: str,
defaultTimeline: str, theme: str, default_timeline: str, theme: str,
access_keys: {}) -> str: access_keys: {}) -> str:
"""Shows the edit links screen """Shows the edit links screen
""" """
@ -451,7 +451,8 @@ def html_edit_links(css_cache: {}, translate: {}, base_dir: str, path: str,
# top banner # top banner
edit_links_form += \ edit_links_form += \
'<header>\n' + \ '<header>\n' + \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" title="' + \ '<a href="/users/' + nickname + '/' + default_timeline + \
'" title="' + \
translate['Switch to timeline view'] + '" alt="' + \ translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '" ' + \ translate['Switch to timeline view'] + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">\n' 'accesskey="' + access_keys['menuTimeline'] + '">\n'

View File

@ -59,7 +59,7 @@ def get_right_column_content(base_dir: str, nickname: str, domain_full: str,
authorized: bool, authorized: bool,
showHeaderImage: bool, showHeaderImage: bool,
theme: str, theme: str,
defaultTimeline: str, default_timeline: str,
access_keys: {}) -> str: access_keys: {}) -> str:
"""Returns html content for the right column """Returns html content for the right column
""" """
@ -71,7 +71,7 @@ def get_right_column_content(base_dir: str, nickname: str, domain_full: str,
# only show the publish button if logged in, otherwise replace it with # only show the publish button if logged in, otherwise replace it with
# a login button # a login button
titleStr = translate['Publish a blog article'] titleStr = translate['Publish a blog article']
if defaultTimeline == 'tlfeatures': if default_timeline == 'tlfeatures':
titleStr = translate['Publish a news article'] titleStr = translate['Publish a news article']
publishButtonStr = \ publishButtonStr = \
' <a href="' + \ ' <a href="' + \
@ -174,7 +174,7 @@ def get_right_column_content(base_dir: str, nickname: str, domain_full: str,
if showPublishButton: if showPublishButton:
if show_publish_as_icon: if show_publish_as_icon:
titleStr = translate['Publish a blog article'] titleStr = translate['Publish a blog article']
if defaultTimeline == 'tlfeatures': if default_timeline == 'tlfeatures':
titleStr = translate['Publish a news article'] titleStr = translate['Publish a news article']
htmlStr += \ htmlStr += \
' <a href="' + \ ' <a href="' + \
@ -330,7 +330,7 @@ def _html_newswire(base_dir: str, newswire: {}, nickname: str, moderator: bool,
def html_citations(base_dir: str, nickname: str, domain: str, def html_citations(base_dir: str, nickname: str, domain: str,
http_prefix: str, defaultTimeline: str, http_prefix: str, default_timeline: str,
translate: {}, newswire: {}, css_cache: {}, translate: {}, newswire: {}, css_cache: {},
blogTitle: str, blogContent: str, blogTitle: str, blogContent: str,
blogImageFilename: str, blogImageFilename: str,
@ -456,7 +456,7 @@ def html_newswire_mobile(css_cache: {}, base_dir: str, nickname: str,
authorized: bool, authorized: bool,
rss_icon_at_top: bool, rss_icon_at_top: bool,
icons_as_buttons: bool, icons_as_buttons: bool,
defaultTimeline: str, default_timeline: str,
theme: str, theme: str,
access_keys: {}) -> str: access_keys: {}) -> str:
"""Shows the mobile version of the newswire right column """Shows the mobile version of the newswire right column
@ -488,7 +488,7 @@ def html_newswire_mobile(css_cache: {}, base_dir: str, nickname: str,
banner_file, banner_filename = \ banner_file, banner_filename = \
get_banner_file(base_dir, nickname, domain, theme) get_banner_file(base_dir, nickname, domain, theme)
htmlStr += \ htmlStr += \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" ' + \ '<a href="/users/' + nickname + '/' + default_timeline + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">' + \ 'accesskey="' + access_keys['menuTimeline'] + '">' + \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'alt="' + translate['Timeline banner image'] + '" ' + \ 'alt="' + translate['Timeline banner image'] + '" ' + \
@ -508,7 +508,7 @@ def html_newswire_mobile(css_cache: {}, base_dir: str, nickname: str,
False, timelinePath, showPublishButton, False, timelinePath, showPublishButton,
show_publish_as_icon, rss_icon_at_top, False, show_publish_as_icon, rss_icon_at_top, False,
authorized, False, theme, authorized, False, theme,
defaultTimeline, access_keys) default_timeline, access_keys)
if editor and not newswire: if editor and not newswire:
htmlStr += '<br><br><br>\n' htmlStr += '<br><br><br>\n'
htmlStr += '<center>\n ' htmlStr += '<center>\n '
@ -523,7 +523,7 @@ def html_newswire_mobile(css_cache: {}, base_dir: str, nickname: str,
def html_edit_newswire(css_cache: {}, translate: {}, base_dir: str, path: str, def html_edit_newswire(css_cache: {}, translate: {}, base_dir: str, path: str,
domain: str, port: int, http_prefix: str, domain: str, port: int, http_prefix: str,
defaultTimeline: str, theme: str, default_timeline: str, theme: str,
access_keys: {}) -> str: access_keys: {}) -> str:
"""Shows the edit newswire screen """Shows the edit newswire screen
""" """
@ -556,7 +556,8 @@ def html_edit_newswire(css_cache: {}, translate: {}, base_dir: str, path: str,
# top banner # top banner
editNewswireForm += \ editNewswireForm += \
'<header>' + \ '<header>' + \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" title="' + \ '<a href="/users/' + nickname + '/' + default_timeline + \
'" title="' + \
translate['Switch to timeline view'] + '" alt="' + \ translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '" ' + \ translate['Switch to timeline view'] + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">\n' 'accesskey="' + access_keys['menuTimeline'] + '">\n'

View File

@ -70,7 +70,7 @@ def _html_new_post_drop_down(scopeIcon: str, scopeDescription: str,
replyStr: str, replyStr: str,
translate: {}, translate: {},
showPublicOnDropdown: bool, showPublicOnDropdown: bool,
defaultTimeline: str, default_timeline: str,
pathBase: str, pathBase: str,
dropdownNewPostSuffix: str, dropdownNewPostSuffix: str,
dropdownNewBlogSuffix: str, dropdownNewBlogSuffix: str,
@ -105,7 +105,7 @@ def _html_new_post_drop_down(scopeIcon: str, scopeDescription: str,
'icons/scope_public.png"/><b>' + \ 'icons/scope_public.png"/><b>' + \
translate['Public'] + '</b><br>' + \ translate['Public'] + '</b><br>' + \
translate['Visible to anyone'] + '</a></li>\n' translate['Visible to anyone'] + '</a></li>\n'
if defaultTimeline == 'tlfeatures': if default_timeline == 'tlfeatures':
dropDownContent += \ dropDownContent += \
'<li><a href="' + pathBase + dropdownNewBlogSuffix + \ '<li><a href="' + pathBase + dropdownNewBlogSuffix + \
'" accesskey="' + access_keys['menuBlogs'] + '">' + \ '" accesskey="' + access_keys['menuBlogs'] + '">' + \
@ -193,7 +193,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
category: str, category: str,
nickname: str, domain: str, nickname: str, domain: str,
domain_full: str, domain_full: str,
defaultTimeline: str, newswire: {}, default_timeline: str, newswire: {},
theme: str, noDropDown: bool, theme: str, noDropDown: bool,
access_keys: {}, customSubmitText: str, access_keys: {}, customSubmitText: str,
conversationId: str, conversationId: str,
@ -395,7 +395,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
if path.endswith('/newblog'): if path.endswith('/newblog'):
placeholderSubject = translate['Title'] placeholderSubject = translate['Title']
scopeIcon = 'scope_blog.png' scopeIcon = 'scope_blog.png'
if defaultTimeline != 'tlfeatures': if default_timeline != 'tlfeatures':
scopeDescription = translate['Blog'] scopeDescription = translate['Blog']
else: else:
scopeDescription = translate['Article'] scopeDescription = translate['Article']
@ -643,7 +643,8 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
newPostForm += \ newPostForm += \
'<header>\n' + \ '<header>\n' + \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" title="' + \ '<a href="/users/' + nickname + '/' + default_timeline + \
'" title="' + \
translate['Switch to timeline view'] + '" alt="' + \ translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '" ' + \ translate['Switch to timeline view'] + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">\n' 'accesskey="' + access_keys['menuTimeline'] + '">\n'
@ -712,7 +713,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
replyStr, replyStr,
translate, translate,
showPublicOnDropdown, showPublicOnDropdown,
defaultTimeline, default_timeline,
pathBase, pathBase,
dropdownNewPostSuffix, dropdownNewPostSuffix,
dropdownNewBlogSuffix, dropdownNewBlogSuffix,

View File

@ -97,7 +97,7 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
def html_front_screen(signing_priv_key_pem: str, def html_front_screen(signing_priv_key_pem: str,
rss_icon_at_top: bool, rss_icon_at_top: bool,
css_cache: {}, icons_as_buttons: bool, css_cache: {}, icons_as_buttons: bool,
defaultTimeline: str, default_timeline: str,
recent_posts_cache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, project_version: str, translate: {}, project_version: str,
base_dir: str, http_prefix: str, authorized: bool, base_dir: str, http_prefix: str, authorized: bool,
@ -199,7 +199,7 @@ def html_front_screen(signing_priv_key_pem: str,
False, False, newswire, False, False, False, newswire, False,
False, None, False, False, False, None, False, False,
False, True, authorized, True, theme, False, True, authorized, True, theme,
defaultTimeline, access_keys) default_timeline, access_keys)
profileFooterStr += \ profileFooterStr += \
' </td>\n' + \ ' </td>\n' + \
' </tr>\n' + \ ' </tr>\n' + \

View File

@ -17,7 +17,7 @@ from happening import day_events_check
from webapp_utils import html_highlight_label from webapp_utils import html_highlight_label
def header_buttons_timeline(defaultTimeline: str, def header_buttons_timeline(default_timeline: str,
boxName: str, boxName: str,
pageNumber: int, pageNumber: int,
translate: {}, translate: {},
@ -54,20 +54,20 @@ def header_buttons_timeline(defaultTimeline: str,
# start of the button header with inbox, outbox, etc # start of the button header with inbox, outbox, etc
tlStr = '<div class="containerHeader"><nav>\n' tlStr = '<div class="containerHeader"><nav>\n'
# first button # first button
if defaultTimeline == 'tlmedia': if default_timeline == 'tlmedia':
tlStr += \ tlStr += \
'<a href="' + usersPath + '/tlmedia" tabindex="-1" ' + \ '<a href="' + usersPath + '/tlmedia" tabindex="-1" ' + \
'accesskey="' + access_keys['menuMedia'] + '"' + \ 'accesskey="' + access_keys['menuMedia'] + '"' + \
'><button class="' + \ '><button class="' + \
mediaButton + '"><span>' + translate['Media'] + \ mediaButton + '"><span>' + translate['Media'] + \
'</span></button></a>' '</span></button></a>'
elif defaultTimeline == 'tlblogs': elif default_timeline == 'tlblogs':
tlStr += \ tlStr += \
'<a href="' + usersPath + \ '<a href="' + usersPath + \
'/tlblogs" tabindex="-1"><button class="' + \ '/tlblogs" tabindex="-1"><button class="' + \
blogsButton + '"><span>' + translate['Blogs'] + \ blogsButton + '"><span>' + translate['Blogs'] + \
'</span></button></a>' '</span></button></a>'
elif defaultTimeline == 'tlfeatures': elif default_timeline == 'tlfeatures':
tlStr += \ tlStr += \
'<a href="' + usersPath + \ '<a href="' + usersPath + \
'/tlfeatures" tabindex="-1"><button class="' + \ '/tlfeatures" tabindex="-1"><button class="' + \
@ -82,7 +82,7 @@ def header_buttons_timeline(defaultTimeline: str,
# if this is a news instance and we are viewing the news timeline # if this is a news instance and we are viewing the news timeline
featuresHeader = False featuresHeader = False
if defaultTimeline == 'tlfeatures' and boxName == 'tlfeatures': if default_timeline == 'tlfeatures' and boxName == 'tlfeatures':
featuresHeader = True featuresHeader = True
if not featuresHeader: if not featuresHeader:
@ -102,7 +102,7 @@ def header_buttons_timeline(defaultTimeline: str,
'</span></button></a>' '</span></button></a>'
# typically the media button # typically the media button
if defaultTimeline != 'tlmedia': if default_timeline != 'tlmedia':
if not minimal and not featuresHeader: if not minimal and not featuresHeader:
tlStr += \ tlStr += \
'<a href="' + usersPath + '/tlmedia" tabindex="-1" ' + \ '<a href="' + usersPath + '/tlmedia" tabindex="-1" ' + \
@ -121,10 +121,10 @@ def header_buttons_timeline(defaultTimeline: str,
if not featuresHeader: if not featuresHeader:
# typically the blogs button # typically the blogs button
# but may change if this is a blogging oriented instance # but may change if this is a blogging oriented instance
if defaultTimeline != 'tlblogs': if default_timeline != 'tlblogs':
if not minimal: if not minimal:
titleStr = translate['Blogs'] titleStr = translate['Blogs']
if defaultTimeline == 'tlfeatures': if default_timeline == 'tlfeatures':
titleStr = translate['Article'] titleStr = translate['Article']
tlStr += \ tlStr += \
'<a href="' + usersPath + \ '<a href="' + usersPath + \
@ -141,7 +141,7 @@ def header_buttons_timeline(defaultTimeline: str,
# typically the news button # typically the news button
# but may change if this is a news oriented instance # but may change if this is a news oriented instance
if defaultTimeline == 'tlfeatures': if default_timeline == 'tlfeatures':
if not featuresHeader: if not featuresHeader:
tlStr += \ tlStr += \
'<a href="' + usersPath + \ '<a href="' + usersPath + \

View File

@ -30,7 +30,7 @@ from blocking import is_blocked
from session import create_session from session import create_session
def html_moderation(css_cache: {}, defaultTimeline: str, def html_moderation(css_cache: {}, default_timeline: str,
recent_posts_cache: {}, max_recent_posts: int, recent_posts_cache: {}, max_recent_posts: int,
translate: {}, pageNumber: int, itemsPerPage: int, translate: {}, pageNumber: int, itemsPerPage: int,
session, base_dir: str, wfRequest: {}, person_cache: {}, session, base_dir: str, wfRequest: {}, person_cache: {},
@ -59,7 +59,7 @@ def html_moderation(css_cache: {}, defaultTimeline: str,
This is what you see when selecting the "mod" timeline This is what you see when selecting the "mod" timeline
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
return html_timeline(css_cache, defaultTimeline, return html_timeline(css_cache, default_timeline,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, translate, pageNumber,
itemsPerPage, session, base_dir, itemsPerPage, session, base_dir,

View File

@ -31,7 +31,7 @@ from webapp_utils import get_broken_link_substitute
from webapp_utils import html_keyboard_navigation from webapp_utils import html_keyboard_navigation
def html_person_options(defaultTimeline: str, def html_person_options(default_timeline: str,
css_cache: {}, translate: {}, base_dir: str, css_cache: {}, translate: {}, base_dir: str,
domain: str, domain_full: str, domain: str, domain_full: str,
originPathStr: str, originPathStr: str,
@ -352,7 +352,7 @@ def html_person_options(defaultTimeline: str,
optionsStr += optionsLinkStr optionsStr += optionsLinkStr
backPath = '/' backPath = '/'
if nickname: if nickname:
backPath = '/users/' + nickname + '/' + defaultTimeline backPath = '/users/' + nickname + '/' + default_timeline
if 'moderation' in backToPath: if 'moderation' in backToPath:
backPath = '/users/' + nickname + '/moderation' backPath = '/users/' + nickname + '/moderation'
if authorized and originPathStr == '/users/' + nickname: if authorized and originPathStr == '/users/' + nickname:

View File

@ -374,7 +374,7 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {},
def html_search(css_cache: {}, translate: {}, def html_search(css_cache: {}, translate: {},
base_dir: str, path: str, domain: str, base_dir: str, path: str, domain: str,
defaultTimeline: str, theme: str, default_timeline: str, theme: str,
text_mode_banner: str, access_keys: {}) -> str: text_mode_banner: str, access_keys: {}) -> str:
"""Search called from the timeline icon """Search called from the timeline icon
""" """
@ -404,7 +404,7 @@ def html_search(css_cache: {}, translate: {},
usersPath = '/users/' + searchNickname usersPath = '/users/' + searchNickname
followStr += \ followStr += \
'<header>\n' + text_mode_bannerStr + \ '<header>\n' + text_mode_bannerStr + \
'<a href="' + usersPath + '/' + defaultTimeline + '" title="' + \ '<a href="' + usersPath + '/' + default_timeline + '" title="' + \
translate['Switch to timeline view'] + '" alt="' + \ translate['Switch to timeline view'] + '" alt="' + \
translate['Switch to timeline view'] + '" ' + \ translate['Switch to timeline view'] + '" ' + \
'accesskey="' + timelineKey + '">\n' 'accesskey="' + timelineKey + '">\n'

View File

@ -168,7 +168,7 @@ color_to_hex = {
def html_theme_designer(css_cache: {}, base_dir: str, def html_theme_designer(css_cache: {}, base_dir: str,
nickname: str, domain: str, nickname: str, domain: str,
translate: {}, defaultTimeline: str, translate: {}, default_timeline: str,
theme_name: str, access_keys: {}) -> str: theme_name: str, access_keys: {}) -> str:
"""Edit theme settings """Edit theme settings
""" """
@ -197,7 +197,7 @@ def html_theme_designer(css_cache: {}, base_dir: str,
banner_file, banner_filename = \ banner_file, banner_filename = \
get_banner_file(base_dir, nickname, domain, theme_name) get_banner_file(base_dir, nickname, domain, theme_name)
themeForm += \ themeForm += \
'<a href="/users/' + nickname + '/' + defaultTimeline + '" ' + \ '<a href="/users/' + nickname + '/' + default_timeline + '" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">' + \ 'accesskey="' + access_keys['menuTimeline'] + '">' + \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'title="' + translate['Switch to timeline view'] + '" ' + \ 'title="' + translate['Switch to timeline view'] + '" ' + \

View File

@ -1504,7 +1504,7 @@ def html_show_share(base_dir: str, domain: str, nickname: str,
http_prefix: str, domain_full: str, http_prefix: str, domain_full: str,
itemID: str, translate: {}, itemID: str, translate: {},
shared_items_federated_domains: [], shared_items_federated_domains: [],
defaultTimeline: str, theme: str, default_timeline: str, theme: str,
sharesFileType: str, category: str) -> str: sharesFileType: str, category: str) -> str:
"""Shows an individual shared item after selecting it from the left column """Shows an individual shared item after selecting it from the left column
""" """
@ -1562,7 +1562,7 @@ def html_show_share(base_dir: str, domain: str, nickname: str,
shareStr = \ shareStr = \
'<header>\n' + \ '<header>\n' + \
'<a href="/users/' + nickname + '/' + \ '<a href="/users/' + nickname + '/' + \
defaultTimeline + '" title="" alt="">\n' default_timeline + '" title="" alt="">\n'
shareStr += '<img loading="lazy" class="timeline-banner" ' + \ shareStr += '<img loading="lazy" class="timeline-banner" ' + \
'alt="" ' + \ 'alt="" ' + \
'src="/users/' + nickname + '/' + banner_file + '" /></a>\n' + \ 'src="/users/' + nickname + '/' + banner_file + '" /></a>\n' + \