From ae65c33553abf14b587375743647134234ba9bb8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 25 Dec 2021 23:09:49 +0000 Subject: [PATCH] Snake case --- daemon.py | 50 ++++++++++++++++++------------------- theme.py | 14 +++++------ webapp_calendar.py | 4 +-- webapp_moderation.py | 4 +-- webapp_person_options.py | 4 +-- webapp_profile.py | 8 +++--- webapp_search.py | 10 ++++---- webapp_timeline.py | 53 ++++++++++++++++++++-------------------- 8 files changed, 74 insertions(+), 73 deletions(-) diff --git a/daemon.py b/daemon.py index f0d626dbc..078239f7b 100644 --- a/daemon.py +++ b/daemon.py @@ -5014,7 +5014,7 @@ class PubServer(BaseHTTPRequestHandler): setTheme(base_dir, self.server.themeName, domain, allow_local_network_access, system_language) - self.server.textModeBanner = \ + self.server.text_mode_banner = \ getTextModeBanner(self.server.base_dir) self.server.iconsCache = {} self.server.fontsCache = {} @@ -5954,7 +5954,7 @@ class PubServer(BaseHTTPRequestHandler): setTheme(base_dir, currTheme, domain, allow_local_network_access, system_language) - self.server.textModeBanner = \ + self.server.text_mode_banner = \ getTextModeBanner(base_dir) self.server.iconsCache = {} self.server.fontsCache = {} @@ -7167,7 +7167,7 @@ class PubServer(BaseHTTPRequestHandler): backToPath, lockedAccount, movedTo, alsoKnownAs, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.news_instance, authorized, accessKeys, isGroup).encode('utf-8') @@ -9713,7 +9713,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -9829,7 +9829,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -10260,7 +10260,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -10412,7 +10412,7 @@ class PubServer(BaseHTTPRequestHandler): authorized, self.server.themeName, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -10557,7 +10557,7 @@ class PubServer(BaseHTTPRequestHandler): authorized, self.server.themeName, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -10699,7 +10699,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -10841,7 +10841,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -10993,7 +10993,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11144,7 +11144,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11252,7 +11252,7 @@ class PubServer(BaseHTTPRequestHandler): authorized, self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11337,7 +11337,7 @@ class PubServer(BaseHTTPRequestHandler): authorized, self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11462,7 +11462,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11600,7 +11600,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11734,7 +11734,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName, self.server.peertubeInstances, allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys, self.server.system_language, self.server.max_like_count, @@ -11854,7 +11854,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -11975,7 +11975,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -12095,7 +12095,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -12231,7 +12231,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dormant_months, self.server.peertubeInstances, self.server.allow_local_network_access, - self.server.textModeBanner, + self.server.text_mode_banner, self.server.debug, accessKeys, city, self.server.system_language, @@ -13077,7 +13077,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline, self.server.themeName, peertubeInstances, - self.server.textModeBanner, + self.server.text_mode_banner, city, self.server.user_agents_blocked, accessKeys, @@ -15123,7 +15123,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain, self.server.defaultTimeline, self.server.themeName, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, callingDomain, @@ -15176,7 +15176,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.base_dir, self.path, self.server.http_prefix, self.server.domainFull, - self.server.textModeBanner, + self.server.text_mode_banner, accessKeys).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, callingDomain, @@ -18537,7 +18537,7 @@ def runDaemon(content_license_url: str, httpd.show_node_info_version = show_node_info_version # ASCII/ANSI text banner used in shell browsers, such as Lynx - httpd.textModeBanner = getTextModeBanner(base_dir) + httpd.text_mode_banner = getTextModeBanner(base_dir) # key shortcuts SHIFT + ALT + [key] httpd.accessKeys = { diff --git a/theme.py b/theme.py index 7b18b565a..1d06dea84 100644 --- a/theme.py +++ b/theme.py @@ -593,9 +593,9 @@ def _setThemeFonts(base_dir: str, themeName: str) -> None: def getTextModeBanner(base_dir: str) -> str: """Returns the banner used for shell browsers, like Lynx """ - textModeBannerFilename = base_dir + '/accounts/banner.txt' - if os.path.isfile(textModeBannerFilename): - with open(textModeBannerFilename, 'r') as fp: + text_mode_bannerFilename = base_dir + '/accounts/banner.txt' + if os.path.isfile(text_mode_bannerFilename): + with open(text_mode_bannerFilename, 'r') as fp: bannerStr = fp.read() if bannerStr: return bannerStr.replace('\n', '
') @@ -639,7 +639,7 @@ def _setTextModeTheme(base_dir: str, name: str) -> None: base_dir + '/accounts/logo.txt') # set the text mode banner which appears in browsers such as Lynx - textModeBannerFilename = \ + text_mode_bannerFilename = \ base_dir + '/theme/' + name + '/banner.txt' if os.path.isfile(base_dir + '/accounts/banner.txt'): try: @@ -647,13 +647,13 @@ def _setTextModeTheme(base_dir: str, name: str) -> None: except OSError: print('EX: _setTextModeTheme unable to delete ' + base_dir + '/accounts/banner.txt') - if os.path.isfile(textModeBannerFilename): + if os.path.isfile(text_mode_bannerFilename): try: - copyfile(textModeBannerFilename, + copyfile(text_mode_bannerFilename, base_dir + '/accounts/banner.txt') except OSError: print('EX: _setTextModeTheme unable to copy ' + - textModeBannerFilename + ' ' + + text_mode_bannerFilename + ' ' + base_dir + '/accounts/banner.txt') diff --git a/webapp_calendar.py b/webapp_calendar.py index 857a474da..28bda223a 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -246,7 +246,7 @@ def _htmlCalendarDay(person_cache: {}, cssCache: {}, translate: {}, def htmlCalendar(person_cache: {}, cssCache: {}, translate: {}, base_dir: str, path: str, http_prefix: str, domainFull: str, - textModeBanner: str, accessKeys: {}) -> str: + text_mode_banner: str, accessKeys: {}) -> str: """Show the calendar for a person """ domain = removeDomainPort(domainFull) @@ -451,7 +451,7 @@ def htmlCalendar(person_cache: {}, cssCache: {}, translate: {}, navAccessKeys = { } screenReaderCal = \ - htmlKeyboardNavigation(textModeBanner, navLinks, navAccessKeys, + htmlKeyboardNavigation(text_mode_banner, navLinks, navAccessKeys, monthName) newEventStr = \ diff --git a/webapp_moderation.py b/webapp_moderation.py index 8aca5a9a6..620c0cbba 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -49,7 +49,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str, authorized: bool, moderationActionStr: str, theme: str, peertubeInstances: [], allow_local_network_access: bool, - textModeBanner: str, + text_mode_banner: str, accessKeys: {}, system_language: str, max_like_count: int, shared_items_federated_domains: [], @@ -77,7 +77,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str, publish_button_at_top, authorized, moderationActionStr, theme, peertubeInstances, allow_local_network_access, - textModeBanner, accessKeys, system_language, + text_mode_banner, accessKeys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, CWlists, lists_enabled) diff --git a/webapp_person_options.py b/webapp_person_options.py index 4617e2dc8..afd9cca8e 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -58,7 +58,7 @@ def htmlPersonOptions(defaultTimeline: str, lockedAccount: bool, movedTo: str, alsoKnownAs: [], - textModeBanner: str, + text_mode_banner: str, news_instance: bool, authorized: bool, accessKeys: {}, @@ -131,7 +131,7 @@ def htmlPersonOptions(defaultTimeline: str, instanceTitle = \ getConfigParam(base_dir, 'instanceTitle') optionsStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None) - optionsStr += htmlKeyboardNavigation(textModeBanner, {}, {}) + optionsStr += htmlKeyboardNavigation(text_mode_banner, {}, {}) optionsStr += '

\n' optionsStr += '
\n' optionsStr += '
\n' diff --git a/webapp_profile.py b/webapp_profile.py index 8c38c6f4e..5df7edc35 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -556,7 +556,7 @@ def htmlProfile(signing_priv_key_pem: str, newswire: {}, theme: str, dormant_months: int, peertubeInstances: [], allow_local_network_access: bool, - textModeBanner: str, + text_mode_banner: str, debug: bool, accessKeys: {}, city: str, system_language: str, max_like_count: int, shared_items_federated_domains: [], @@ -897,7 +897,7 @@ def htmlProfile(signing_priv_key_pem: str, continue navAccessKeys[locals()[variableName]] = key - profileStr = htmlKeyboardNavigation(textModeBanner, + profileStr = htmlKeyboardNavigation(text_mode_banner, navLinks, navAccessKeys) profileStr += profileHeaderStr + donateSection @@ -2092,7 +2092,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str, domain: str, port: int, http_prefix: str, defaultTimeline: str, theme: str, peertubeInstances: [], - textModeBanner: str, city: str, + text_mode_banner: str, city: str, user_agents_blocked: str, accessKeys: {}, default_reply_interval_hrs: int, @@ -2252,7 +2252,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str, menuProfile: 'p', menuTimeline: 't' } - editProfileForm += htmlKeyboardNavigation(textModeBanner, + editProfileForm += htmlKeyboardNavigation(text_mode_banner, navLinks, navAccessKeys) # top banner diff --git a/webapp_search.py b/webapp_search.py index ae3825af6..5fe9d215a 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -373,7 +373,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {}, def htmlSearch(cssCache: {}, translate: {}, base_dir: str, path: str, domain: str, defaultTimeline: str, theme: str, - textModeBanner: str, accessKeys: {}) -> str: + text_mode_banner: str, accessKeys: {}) -> str: """Search called from the timeline icon """ actor = path.replace('/search', '') @@ -392,15 +392,15 @@ def htmlSearch(cssCache: {}, translate: {}, searchBannerFile, searchBannerFilename = \ getSearchBannerFile(base_dir, searchNickname, domain, theme) - textModeBannerStr = htmlKeyboardNavigation(textModeBanner, {}, {}) - if textModeBannerStr is None: - textModeBannerStr = '' + text_mode_bannerStr = htmlKeyboardNavigation(text_mode_banner, {}, {}) + if text_mode_bannerStr is None: + text_mode_bannerStr = '' if os.path.isfile(searchBannerFilename): timelineKey = accessKeys['menuTimeline'] usersPath = '/users/' + searchNickname followStr += \ - '
\n' + textModeBannerStr + \ + '
\n' + text_mode_bannerStr + \ '