Snake case

main
Bob Mottram 2022-01-03 22:50:01 +00:00
parent f2b734ca8d
commit 9793b725e1
1 changed files with 48 additions and 48 deletions

View File

@ -41,29 +41,29 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
These should only be public blog posts from the features timeline These should only be public blog posts from the features timeline
which is the blog timeline of the news actor which is the blog timeline of the news actor
""" """
separatorStr = html_post_separator(base_dir, None) separator_str = html_post_separator(base_dir, None)
profileStr = '' profile_str = ''
maxItems = 4 max_items = 4
ctr = 0 ctr = 0
currPage = 1 curr_page = 1
boxName = 'tlfeatures' box_name = 'tlfeatures'
authorized = True authorized = True
while ctr < maxItems and currPage < 4: while ctr < max_items and curr_page < 4:
outboxFeedPathStr = \ outbox_feed_path_str = \
'/users/' + nickname + '/' + boxName + \ '/users/' + nickname + '/' + box_name + \
'?page=' + str(currPage) '?page=' + str(curr_page)
outboxFeed = \ outbox_feed = \
person_box_json({}, session, base_dir, domain, port, person_box_json({}, session, base_dir, domain, port,
outboxFeedPathStr, outbox_feed_path_str,
http_prefix, 10, boxName, http_prefix, 10, box_name,
authorized, 0, False, 0) authorized, 0, False, 0)
if not outboxFeed: if not outbox_feed:
break break
if len(outboxFeed['orderedItems']) == 0: if len(outbox_feed['orderedItems']) == 0:
break break
for item in outboxFeed['orderedItems']: for item in outbox_feed['orderedItems']:
if item['type'] == 'Create': if item['type'] == 'Create':
postStr = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -85,13 +85,13 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
False, False, False, False, False, False,
True, False, False, True, False, False,
cw_lists, lists_enabled) cw_lists, lists_enabled)
if postStr: if post_str:
profileStr += postStr + separatorStr profile_str += post_str + separator_str
ctr += 1 ctr += 1
if ctr >= maxItems: if ctr >= max_items:
break break
currPage += 1 curr_page += 1
return profileStr return profile_str
def html_front_screen(signing_priv_key_pem: str, def html_front_screen(signing_priv_key_pem: str,
@ -112,9 +112,9 @@ def html_front_screen(signing_priv_key_pem: str,
access_keys: {}, access_keys: {},
system_language: str, max_like_count: int, system_language: str, max_like_count: int,
shared_items_federated_domains: [], shared_items_federated_domains: [],
extraJson: {}, extra_json: {},
pageNumber: int, page_number: int,
maxItemsPerPage: int, max_items_per_page: int,
cw_lists: {}, lists_enabled: str) -> str: cw_lists: {}, lists_enabled: str) -> str:
"""Show the news instance front screen """Show the news instance front screen
""" """
@ -130,20 +130,20 @@ def html_front_screen(signing_priv_key_pem: str,
if port: if port:
domain_full = domain + ':' + str(port) domain_full = domain + ':' + str(port)
loginButton = header_buttons_front_screen(translate, nickname, login_button = header_buttons_front_screen(translate, nickname,
'features', authorized, 'features', authorized,
icons_as_buttons) icons_as_buttons)
# If this is the news account then show a different banner # If this is the news account then show a different banner
banner_file, banner_filename = \ banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme) get_banner_file(base_dir, nickname, domain, theme)
profileHeaderStr = \ profile_header_str = \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'src="/users/' + nickname + '/' + banner_file + '" />\n' 'src="/users/' + nickname + '/' + banner_file + '" />\n'
if loginButton: if login_button:
profileHeaderStr += '<center>' + loginButton + '</center>\n' profile_header_str += '<center>' + login_button + '</center>\n'
profileHeaderStr += \ profile_header_str += \
'<table class="timeline">\n' + \ '<table class="timeline">\n' + \
' <colgroup>\n' + \ ' <colgroup>\n' + \
' <col span="1" class="column-left">\n' + \ ' <col span="1" class="column-left">\n' + \
@ -153,27 +153,27 @@ def html_front_screen(signing_priv_key_pem: str,
' <tbody>\n' + \ ' <tbody>\n' + \
' <tr>\n' + \ ' <tr>\n' + \
' <td valign="top" class="col-left">\n' ' <td valign="top" class="col-left">\n'
profileHeaderStr += \ profile_header_str += \
get_left_column_content(base_dir, 'news', domain_full, get_left_column_content(base_dir, 'news', domain_full,
http_prefix, translate, http_prefix, translate,
False, False, False, False,
False, None, rss_icon_at_top, True, False, None, rss_icon_at_top, True,
True, theme, access_keys, True, theme, access_keys,
shared_items_federated_domains) shared_items_federated_domains)
profileHeaderStr += \ profile_header_str += \
' </td>\n' + \ ' </td>\n' + \
' <td valign="top" class="col-center">\n' ' <td valign="top" class="col-center">\n'
profileStr = profileHeaderStr profile_str = profile_header_str
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'
licenseStr = '' license_str = ''
banner_file, banner_filename = \ banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme) get_banner_file(base_dir, nickname, domain, theme)
profileStr += \ profile_str += \
_html_front_screen_posts(recent_posts_cache, max_recent_posts, _html_front_screen_posts(recent_posts_cache, max_recent_posts,
translate, translate,
base_dir, http_prefix, base_dir, http_prefix,
@ -188,27 +188,27 @@ def html_front_screen(signing_priv_key_pem: str,
theme, system_language, theme, system_language,
max_like_count, max_like_count,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled) + licenseStr cw_lists, lists_enabled) + license_str
# Footer which is only used for system accounts # Footer which is only used for system accounts
profileFooterStr = ' </td>\n' profile_footer_str = ' </td>\n'
profileFooterStr += ' <td valign="top" class="col-right">\n' profile_footer_str += ' <td valign="top" class="col-right">\n'
profileFooterStr += \ profile_footer_str += \
get_right_column_content(base_dir, 'news', domain_full, get_right_column_content(base_dir, 'news', domain_full,
http_prefix, translate, http_prefix, translate,
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,
default_timeline, access_keys) default_timeline, access_keys)
profileFooterStr += \ profile_footer_str += \
' </td>\n' + \ ' </td>\n' + \
' </tr>\n' + \ ' </tr>\n' + \
' </tbody>\n' + \ ' </tbody>\n' + \
'</table>\n' '</table>\n'
instanceTitle = \ instance_title = \
get_config_param(base_dir, 'instanceTitle') get_config_param(base_dir, 'instanceTitle')
profileStr = \ profile_str = \
html_header_with_external_style(css_filename, instanceTitle, None) + \ html_header_with_external_style(css_filename, instance_title, None) + \
profileStr + profileFooterStr + html_footer() profile_str + profile_footer_str + html_footer()
return profileStr return profile_str