mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
d90fd16128
commit
23af1b48ef
32
utils.py
32
utils.py
|
@ -82,39 +82,39 @@ def get_content_from_post(post_json_object: {}, system_language: str,
|
||||||
"""Returns the content from the post in the given language
|
"""Returns the content from the post in the given language
|
||||||
including searching for a matching entry within contentMap
|
including searching for a matching entry within contentMap
|
||||||
"""
|
"""
|
||||||
thisPostJson = post_json_object
|
this_post_json = post_json_object
|
||||||
if hasObjectDict(post_json_object):
|
if hasObjectDict(post_json_object):
|
||||||
thisPostJson = post_json_object['object']
|
this_post_json = post_json_object['object']
|
||||||
if not thisPostJson.get('content'):
|
if not this_post_json.get('content'):
|
||||||
return ''
|
return ''
|
||||||
content = ''
|
content = ''
|
||||||
if thisPostJson.get('contentMap'):
|
if this_post_json.get('contentMap'):
|
||||||
if isinstance(thisPostJson['contentMap'], dict):
|
if isinstance(this_post_json['contentMap'], dict):
|
||||||
if thisPostJson['contentMap'].get(system_language):
|
if this_post_json['contentMap'].get(system_language):
|
||||||
sys_lang = thisPostJson['contentMap'][system_language]
|
sys_lang = this_post_json['contentMap'][system_language]
|
||||||
if isinstance(sys_lang, str):
|
if isinstance(sys_lang, str):
|
||||||
return thisPostJson['contentMap'][system_language]
|
return this_post_json['contentMap'][system_language]
|
||||||
else:
|
else:
|
||||||
# is there a contentMap entry for one of
|
# is there a contentMap entry for one of
|
||||||
# the understood languages?
|
# the understood languages?
|
||||||
for lang in languages_understood:
|
for lang in languages_understood:
|
||||||
if thisPostJson['contentMap'].get(lang):
|
if this_post_json['contentMap'].get(lang):
|
||||||
return thisPostJson['contentMap'][lang]
|
return this_post_json['contentMap'][lang]
|
||||||
else:
|
else:
|
||||||
if isinstance(thisPostJson['content'], str):
|
if isinstance(this_post_json['content'], str):
|
||||||
content = thisPostJson['content']
|
content = this_post_json['content']
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
||||||
def getBaseContentFromPost(post_json_object: {}, system_language: str) -> str:
|
def getBaseContentFromPost(post_json_object: {}, system_language: str) -> str:
|
||||||
"""Returns the content from the post in the given language
|
"""Returns the content from the post in the given language
|
||||||
"""
|
"""
|
||||||
thisPostJson = post_json_object
|
this_post_json = post_json_object
|
||||||
if hasObjectDict(post_json_object):
|
if hasObjectDict(post_json_object):
|
||||||
thisPostJson = post_json_object['object']
|
this_post_json = post_json_object['object']
|
||||||
if not thisPostJson.get('content'):
|
if not this_post_json.get('content'):
|
||||||
return ''
|
return ''
|
||||||
return thisPostJson['content']
|
return this_post_json['content']
|
||||||
|
|
||||||
|
|
||||||
def acctDir(base_dir: str, nickname: str, domain: str) -> str:
|
def acctDir(base_dir: str, nickname: str, domain: str) -> str:
|
||||||
|
|
Loading…
Reference in New Issue