Snake case

main
Bob Mottram 2021-12-26 10:52:54 +00:00
parent d177997063
commit d90fd16128
4 changed files with 11 additions and 11 deletions

View File

@ -268,11 +268,11 @@ def _htmlBlogPostContent(debug: bool, session, authorized: bool,
personUrl = local_actor_url(http_prefix, nickname, domain_full)
actor_json = \
getPersonFromCache(base_dir, personUrl, person_cache, False)
languagesUnderstood = []
languages_understood = []
if actor_json:
languagesUnderstood = get_actor_languages_list(actor_json)
languages_understood = get_actor_languages_list(actor_json)
jsonContent = get_content_from_post(post_json_object, system_language,
languagesUnderstood)
languages_understood)
if jsonContent:
contentStr = addEmbeddedElements(translate, jsonContent,
peertube_instances)

View File

@ -111,10 +111,10 @@ def understoodPostLanguage(base_dir: str, nickname: str, domain: str,
if not actor_json:
print('WARN: unable to load actor to check languages ' + personUrl)
return False
languagesUnderstood = get_actor_languages_list(actor_json)
if not languagesUnderstood:
languages_understood = get_actor_languages_list(actor_json)
if not languages_understood:
return True
for lang in languagesUnderstood:
for lang in languages_understood:
if msgObject['contentMap'].get(lang):
return True
# is the language for this post supported by libretranslate?

View File

@ -78,7 +78,7 @@ def get_actor_languages_list(actor_json: {}) -> []:
def get_content_from_post(post_json_object: {}, system_language: str,
languagesUnderstood: []) -> str:
languages_understood: []) -> str:
"""Returns the content from the post in the given language
including searching for a matching entry within contentMap
"""
@ -97,7 +97,7 @@ def get_content_from_post(post_json_object: {}, system_language: str,
else:
# is there a contentMap entry for one of
# the understood languages?
for lang in languagesUnderstood:
for lang in languages_understood:
if thisPostJson['contentMap'].get(lang):
return thisPostJson['contentMap'][lang]
else:

View File

@ -1852,11 +1852,11 @@ def individualPostAsHtml(signing_priv_key_pem: str,
personUrl = local_actor_url(http_prefix, nickname, domain_full)
actor_json = \
getPersonFromCache(base_dir, personUrl, person_cache, False)
languagesUnderstood = []
languages_understood = []
if actor_json:
languagesUnderstood = get_actor_languages_list(actor_json)
languages_understood = get_actor_languages_list(actor_json)
contentStr = get_content_from_post(post_json_object, system_language,
languagesUnderstood)
languages_understood)
if not contentStr:
contentStr = \
autoTranslatePost(base_dir, post_json_object,