diff --git a/webapp_column_left.py b/webapp_column_left.py index 4be31d8b7..61c26d5cc 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -44,7 +44,7 @@ def _get_left_column_shares(base_dir: str, actor = local_actor_url(http_prefix, nickname, domain_full) # NOTE: this could potentially be slow if the number of federated # shared items is large - shares_json, last_page = \ + shares_json, _ = \ shares_timeline_json(actor, page_number, max_shares_in_left_column, base_dir, domain, nickname, max_shares_in_left_column, @@ -54,7 +54,7 @@ def _get_left_column_shares(base_dir: str, links_list = [] ctr = 0 - for published, item in shares_json.items(): + for _, item in shares_json.items(): sharedesc = item['displayName'] if '<' in sharedesc or '?' in sharedesc: continue @@ -63,9 +63,9 @@ def _get_left_column_shares(base_dir: str, share_link = actor + '?showshare=' + share_id if item.get('category'): share_link += '?category=' + item['category'] - shareCategory = share_category_icon(item['category']) + share_category = share_category_icon(item['category']) - links_list.append(shareCategory + sharedesc + ' ' + share_link) + links_list.append(share_category + sharedesc + ' ' + share_link) ctr += 1 if ctr >= max_shares_in_left_column: break @@ -87,7 +87,7 @@ def _get_left_column_wanted(base_dir: str, actor = local_actor_url(http_prefix, nickname, domain_full) # NOTE: this could potentially be slow if the number of federated # wanted items is large - shares_json, last_page = \ + shares_json, _ = \ shares_timeline_json(actor, page_number, max_shares_in_left_column, base_dir, domain, nickname, max_shares_in_left_column, @@ -97,7 +97,7 @@ def _get_left_column_wanted(base_dir: str, links_list = [] ctr = 0 - for published, item in shares_json.items(): + for _, item in shares_json.items(): sharedesc = item['displayName'] if '<' in sharedesc or ';' in sharedesc: continue @@ -117,9 +117,9 @@ def _get_left_column_wanted(base_dir: str, def get_left_column_content(base_dir: str, nickname: str, domain_full: str, http_prefix: str, translate: {}, editor: bool, artist: bool, - showBackButton: bool, timelinePath: str, - rss_icon_at_top: bool, showHeaderImage: bool, - frontPage: bool, theme: str, + show_back_button: bool, timelinePath: str, + rss_icon_at_top: bool, show_header_image: bool, + front_page: bool, theme: str, access_keys: {}, shared_items_federated_domains: []) -> str: """Returns html content for the left column @@ -129,31 +129,31 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, separator_str = html_post_separator(base_dir, 'left') domain = remove_domain_port(domain_full) - editImageClass = '' - if showHeaderImage: - leftImageFile, leftColumnImageFilename = \ + edit_image_class = '' + if show_header_image: + left_image_file, left_column_image_filename = \ get_left_image_file(base_dir, nickname, domain, theme) # show the image at the top of the column - editImageClass = 'leftColEdit' - if os.path.isfile(leftColumnImageFilename): - editImageClass = 'leftColEditImage' + edit_image_class = 'leftColEdit' + if os.path.isfile(left_column_image_filename): + edit_image_class = 'leftColEditImage' html_str += \ '\n
\n \n' + \ + nickname + '/' + left_image_file + '" />\n' + \ '
\n' - if showBackButton: + if show_back_button: html_str += \ '
' + \ '\n' - if (editor or rss_icon_at_top) and not showHeaderImage: + if (editor or rss_icon_at_top) and not show_header_image: html_str += '
' - if editImageClass == 'leftColEdit': + if edit_image_class == 'leftColEdit': html_str += '\n
\n' html_str += '
\n' @@ -163,7 +163,7 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, html_str += \ ' ' + \ - '' + \
+            '<img class=\n' @@ -172,82 +172,82 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, html_str += \ ' ' + \ - '' + \
+            '<img class=\n' # RSS icon if nickname != 'news': # rss feed for this account - rssUrl = http_prefix + '://' + domain_full + \ + rss_url = http_prefix + '://' + domain_full + \ '/blog/' + nickname + '/rss.xml' else: # rss feed for all accounts on the instance - rssUrl = http_prefix + '://' + domain_full + '/blog/rss.xml' - if not frontPage: - rssTitle = translate['RSS feed for your blog'] + rss_url = http_prefix + '://' + domain_full + '/blog/rss.xml' + if not front_page: + rss_title = translate['RSS feed for your blog'] else: - rssTitle = translate['RSS feed for this site'] - rssIconStr = \ - ' ' + rssTitle + '' + rss_title + '\n' if rss_icon_at_top: - html_str += rssIconStr + html_str += rss_icon_str html_str += '
\n' - if editImageClass == 'leftColEdit': + if edit_image_class == 'leftColEdit': html_str += '
\n' - if (editor or rss_icon_at_top) and not showHeaderImage: + if (editor or rss_icon_at_top) and not show_header_image: html_str += '

' - # if showHeaderImage: + # if show_header_image: # html_str += '
' # flag used not to show the first separator first_separator_added = False links_filename = base_dir + '/accounts/links.txt' - linksFileContainsEntries = False + links_file_contains_entries = False links_list = None if os.path.isfile(links_filename): - with open(links_filename, 'r') as f: - links_list = f.readlines() + with open(links_filename, 'r') as fp_links: + links_list = fp_links.readlines() - if not frontPage: + if not front_page: # show a number of shares max_shares_in_left_column = 3 - sharesList = \ + shares_list = \ _get_left_column_shares(base_dir, http_prefix, domain, domain_full, nickname, max_shares_in_left_column, translate, shared_items_federated_domains) - if links_list and sharesList: - links_list = sharesList + links_list + if links_list and shares_list: + links_list = shares_list + links_list - wantedList = \ + wanted_list = \ _get_left_column_wanted(base_dir, http_prefix, domain, domain_full, nickname, max_shares_in_left_column, translate, shared_items_federated_domains) - if links_list and wantedList: - links_list = wantedList + links_list + if links_list and wanted_list: + links_list = wanted_list + links_list - newTabStr = ' target="_blank" rel="nofollow noopener noreferrer"' + new_tab_str = ' target="_blank" rel="nofollow noopener noreferrer"' if links_list: html_str += '\n' if first_separator_added: @@ -344,8 +344,8 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, '

' + \ translate['Terms of Service'] + '

' - if linksFileContainsEntries and not rss_icon_at_top: - html_str += '
' + rssIconStr + '
' + if links_file_contains_entries and not rss_icon_at_top: + html_str += '
' + rss_icon_str + '
' return html_str @@ -382,7 +382,7 @@ def html_links_mobile(css_cache: {}, base_dir: str, get_config_param(base_dir, 'instanceTitle') html_str = \ html_header_with_external_style(css_filename, instance_title, None) - banner_file, banner_filename = \ + banner_file, _ = \ get_banner_file(base_dir, nickname, domain, theme) html_str += \ ''