From f2b734ca8d135474af797dbe87b89375ee802d38 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Mon, 3 Jan 2022 22:37:22 +0000
Subject: [PATCH] Snake case
---
webapp_column_right.py | 522 ++++++++++++++++++++---------------------
1 file changed, 261 insertions(+), 261 deletions(-)
diff --git a/webapp_column_right.py b/webapp_column_right.py
index 695d63c36..1940f307d 100644
--- a/webapp_column_right.py
+++ b/webapp_column_right.py
@@ -33,179 +33,179 @@ from webapp_utils import header_buttons_front_screen
from webapp_utils import edit_text_field
-def _votes_indicator(totalVotes: int, positive_voting: bool) -> str:
+def _votes_indicator(total_votes: int, positive_voting: bool) -> str:
"""Returns an indicator of the number of votes on a newswire item
"""
- if totalVotes <= 0:
+ if total_votes <= 0:
return ''
- totalVotesStr = ' '
- for v in range(totalVotes):
+ total_votes_str = ' '
+ for _ in range(total_votes):
if positive_voting:
- totalVotesStr += '✓'
+ total_votes_str += '✓'
else:
- totalVotesStr += '✗'
- return totalVotesStr
+ total_votes_str += '✗'
+ return total_votes_str
def get_right_column_content(base_dir: str, nickname: str, domain_full: str,
http_prefix: str, translate: {},
moderator: bool, editor: bool,
newswire: {}, positive_voting: bool,
- showBackButton: bool, timelinePath: str,
- showPublishButton: bool,
+ show_back_button: bool, timeline_path: str,
+ show_publish_button: bool,
show_publish_as_icon: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool,
- showHeaderImage: bool,
+ show_header_image: bool,
theme: str,
default_timeline: str,
access_keys: {}) -> str:
"""Returns html content for the right column
"""
- htmlStr = ''
+ html_str = ''
domain = remove_domain_port(domain_full)
if authorized:
# only show the publish button if logged in, otherwise replace it with
# a login button
- titleStr = translate['Publish a blog article']
+ title_str = translate['Publish a blog article']
if default_timeline == 'tlfeatures':
- titleStr = translate['Publish a news article']
- publishButtonStr = \
+ title_str = translate['Publish a news article']
+ publish_button_str = \
' ' + \
'\n'
else:
# if not logged in then replace the publish button with
# a login button
- publishButtonStr = \
+ publish_button_str = \
' \n'
# show publish button at the top if needed
if publish_button_at_top:
- htmlStr += '
' + publishButtonStr + '
'
+ html_str += '
' + publish_button_str + '
'
# show a column header image, eg. title of the theme or newswire banner
- editImageClass = ''
- if showHeaderImage:
- rightImageFile, rightColumnImageFilename = \
+ edit_image_class = ''
+ if show_header_image:
+ right_image_file, right_column_image_filename = \
get_right_image_file(base_dir, nickname, domain, theme)
# show the image at the top of the column
- editImageClass = 'rightColEdit'
- if os.path.isfile(rightColumnImageFilename):
- editImageClass = 'rightColEditImage'
- htmlStr += \
+ edit_image_class = 'rightColEdit'
+ if os.path.isfile(right_column_image_filename):
+ edit_image_class = 'rightColEditImage'
+ html_str += \
'\n
\n'
- if showPublishButton or editor or rss_icon_at_top:
- if not showHeaderImage:
- htmlStr += '
'
+ if show_publish_button or editor or rss_icon_at_top:
+ if not show_header_image:
+ html_str += '
'
- if editImageClass == 'rightColEdit':
- htmlStr += '\n
\n'
+ if edit_image_class == 'rightColEdit':
+ html_str += '\n
\n'
# whether to show a back icon
# This is probably going to be osolete soon
- if showBackButton:
- htmlStr += \
- ' ' + \
+ if show_back_button:
+ html_str += \
+ ' ' + \
'\n'
- if showPublishButton and not publish_button_at_top:
+ if show_publish_button and not publish_button_at_top:
if not show_publish_as_icon:
- htmlStr += publishButtonStr
+ html_str += publish_button_str
# show the edit icon
if editor:
if os.path.isfile(base_dir + '/accounts/newswiremoderation.txt'):
# show the edit icon highlighted
- htmlStr += \
+ html_str += \
' ' + \
- '\n'
else:
# show the edit icon
- htmlStr += \
+ html_str += \
' ' + \
- '\n'
# show the RSS icons
- rssIconStr = \
+ rss_icon_str = \
' ' + \
- '\n'
- rssIconStr += \
+ rss_icon_str += \
' ' + \
- '\n'
if rss_icon_at_top:
- htmlStr += rssIconStr
+ html_str += rss_icon_str
# show publish icon at top
- if showPublishButton:
+ if show_publish_button:
if show_publish_as_icon:
- titleStr = translate['Publish a blog article']
+ title_str = translate['Publish a blog article']
if default_timeline == 'tlfeatures':
- titleStr = translate['Publish a news article']
- htmlStr += \
+ title_str = translate['Publish a news article']
+ html_str += \
' ' + \
- '\n'
- if editImageClass == 'rightColEdit':
- htmlStr += '
\n'
+ if edit_image_class == 'rightColEdit':
+ html_str += '
\n'
else:
- if showHeaderImage:
- htmlStr += ' \n'
+ if show_header_image:
+ html_str += ' \n'
- if showPublishButton or editor or rss_icon_at_top:
- if not showHeaderImage:
- htmlStr += '
'
+ if show_publish_button or editor or rss_icon_at_top:
+ if not show_header_image:
+ html_str += '
'
# show the newswire lines
- newswireContentStr = \
+ newswire_content_str = \
_html_newswire(base_dir, newswire, nickname, moderator, translate,
positive_voting)
- htmlStr += newswireContentStr
+ html_str += newswire_content_str
# show the rss icon at the bottom, typically on the right hand side
- if newswireContentStr and not rss_icon_at_top:
- htmlStr += '
' + rssIconStr + '
'
- return htmlStr
+ if newswire_content_str and not rss_icon_at_top:
+ html_str += '
\n'
+ html_str += ' '
+ html_str += date_shown + '\n'
else:
- totalVotesStr = ''
- totalVotes = 0
+ total_votes_str = ''
+ total_votes = 0
if moderator:
- if moderatedItem:
- totalVotes = votes_on_newswire_item(item[2])
+ if moderated_item:
+ total_votes = votes_on_newswire_item(item[2])
# show a number of ticks or crosses for how many
# votes for or against
- totalVotesStr = \
- _votes_indicator(totalVotes, positive_voting)
+ total_votes_str = \
+ _votes_indicator(total_votes, positive_voting)
title = remove_long_words(item[0], 16, []).replace('\n', ' ')
title = limit_repeated_words(title, 6)
- if moderator and moderatedItem:
- htmlStr += '
' + \
+ if moderator and moderated_item:
+ html_str += '