mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
4b8e54272a
commit
0d291b9292
47
utils.py
47
utils.py
|
@ -473,16 +473,18 @@ def get_content_from_post(post_json_object: {}, system_language: str,
|
||||||
# is there a contentMap/summaryMap entry for one of
|
# is there a contentMap/summaryMap entry for one of
|
||||||
# the understood languages?
|
# the understood languages?
|
||||||
for lang in languages_understood:
|
for lang in languages_understood:
|
||||||
if this_post_json[map_dict].get(lang):
|
if not this_post_json[map_dict].get(lang):
|
||||||
map_lang = this_post_json[map_dict][lang]
|
continue
|
||||||
if isinstance(map_lang, str):
|
map_lang = this_post_json[map_dict][lang]
|
||||||
content = map_lang
|
if not isinstance(map_lang, str):
|
||||||
content = remove_markup_tag(content, 'pre')
|
continue
|
||||||
content = content.replace('&', '&')
|
content = map_lang
|
||||||
# remove underlines
|
content = remove_markup_tag(content, 'pre')
|
||||||
content = content.replace('<u>', '')
|
content = content.replace('&', '&')
|
||||||
content = content.replace('</u>', '')
|
# remove underlines
|
||||||
return standardize_text(content)
|
content = content.replace('<u>', '')
|
||||||
|
content = content.replace('</u>', '')
|
||||||
|
return standardize_text(content)
|
||||||
else:
|
else:
|
||||||
if isinstance(this_post_json[content_type], str):
|
if isinstance(this_post_json[content_type], str):
|
||||||
content = this_post_json[content_type]
|
content = this_post_json[content_type]
|
||||||
|
@ -839,17 +841,22 @@ def is_editor(base_dir: str, nickname: str) -> bool:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
with open(editors_file, 'r', encoding='utf-8') as fp_editors:
|
lines = []
|
||||||
lines = fp_editors.readlines()
|
try:
|
||||||
if len(lines) == 0:
|
with open(editors_file, 'r', encoding='utf-8') as fp_editors:
|
||||||
admin_name = get_config_param(base_dir, 'admin')
|
lines = fp_editors.readlines()
|
||||||
if admin_name:
|
except OSError:
|
||||||
if admin_name == nickname:
|
print('EX: is_editor unable to read ' + editors_file)
|
||||||
return True
|
|
||||||
for editor in lines:
|
if len(lines) == 0:
|
||||||
editor = editor.strip('\n').strip('\r')
|
admin_name = get_config_param(base_dir, 'admin')
|
||||||
if editor == nickname:
|
if admin_name:
|
||||||
|
if admin_name == nickname:
|
||||||
return True
|
return True
|
||||||
|
for editor in lines:
|
||||||
|
editor = editor.strip('\n').strip('\r')
|
||||||
|
if editor == nickname:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue