mirror of https://gitlab.com/bashrc2/epicyon
Check return values for lists
parent
dabbba296d
commit
fa12fe6b15
|
|
@ -609,6 +609,8 @@ def update_blocked_cache(base_dir: str,
|
||||||
blocked_lines = load_list(global_blocking_filename,
|
blocked_lines = load_list(global_blocking_filename,
|
||||||
'EX: update_blocked_cache unable to read ' +
|
'EX: update_blocked_cache unable to read ' +
|
||||||
global_blocking_filename + ' [ex]')
|
global_blocking_filename + ' [ex]')
|
||||||
|
if blocked_lines is None:
|
||||||
|
return blocked_cache_last_updated
|
||||||
# remove newlines
|
# remove newlines
|
||||||
for index, _ in enumerate(blocked_lines):
|
for index, _ in enumerate(blocked_lines):
|
||||||
blocked_lines[index] = remove_eol(blocked_lines[index])
|
blocked_lines[index] = remove_eol(blocked_lines[index])
|
||||||
|
|
@ -1600,6 +1602,8 @@ def set_broch_mode(base_dir: str, domain_full: str, enabled: bool) -> None:
|
||||||
load_list(following_filename,
|
load_list(following_filename,
|
||||||
'EX: set_broch_mode failed to read ' +
|
'EX: set_broch_mode failed to read ' +
|
||||||
following_filename + ' [ex]')
|
following_filename + ' [ex]')
|
||||||
|
if follow_list is None:
|
||||||
|
continue
|
||||||
for handle in follow_list:
|
for handle in follow_list:
|
||||||
if '@' not in handle:
|
if '@' not in handle:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
4
blog.py
4
blog.py
|
|
@ -86,6 +86,8 @@ def _no_of_blog_replies(base_dir: str, http_prefix: str, translate: {},
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(post_filename,
|
load_list(post_filename,
|
||||||
'EX: failed to read blog ' + post_filename)
|
'EX: failed to read blog ' + post_filename)
|
||||||
|
if lines is None:
|
||||||
|
return 0
|
||||||
|
|
||||||
for reply_post_id in lines:
|
for reply_post_id in lines:
|
||||||
reply_post_id = remove_eol(reply_post_id)
|
reply_post_id = remove_eol(reply_post_id)
|
||||||
|
|
@ -157,6 +159,8 @@ def _get_blog_replies(base_dir: str, http_prefix: str, translate: {},
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(post_filename,
|
load_list(post_filename,
|
||||||
'EX: unable to read blog 4 ' + post_filename)
|
'EX: unable to read blog 4 ' + post_filename)
|
||||||
|
if lines is None:
|
||||||
|
return ''
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
replies_str: str = ''
|
replies_str: str = ''
|
||||||
|
|
|
||||||
15
follow.py
15
follow.py
|
|
@ -72,6 +72,8 @@ def create_initial_last_seen(base_dir: str, http_prefix: str) -> None:
|
||||||
load_list(following_filename,
|
load_list(following_filename,
|
||||||
'EX: create_initial_last_seen ' +
|
'EX: create_initial_last_seen ' +
|
||||||
following_filename)
|
following_filename)
|
||||||
|
if following_handles is None:
|
||||||
|
continue
|
||||||
for handle in following_handles:
|
for handle in following_handles:
|
||||||
if '#' in handle:
|
if '#' in handle:
|
||||||
continue
|
continue
|
||||||
|
|
@ -242,6 +244,8 @@ def get_follower_domains(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(followers_file,
|
load_list(followers_file,
|
||||||
'EX: get_follower_domains ' + followers_file)
|
'EX: get_follower_domains ' + followers_file)
|
||||||
|
if lines is None:
|
||||||
|
return []
|
||||||
|
|
||||||
domains_list: list[str] = []
|
domains_list: list[str] = []
|
||||||
for handle in lines:
|
for handle in lines:
|
||||||
|
|
@ -329,6 +333,8 @@ def unfollow_account(base_dir: str, nickname: str, domain: str,
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(filename,
|
load_list(filename,
|
||||||
'EX: unfollow_account ' + filename)
|
'EX: unfollow_account ' + filename)
|
||||||
|
if lines is None:
|
||||||
|
return False
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
try:
|
try:
|
||||||
|
|
@ -409,6 +415,9 @@ def _get_no_of_follows(base_dir: str, nickname: str, domain: str,
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(filename,
|
load_list(filename,
|
||||||
'EX: _get_no_of_follows ' + filename)
|
'EX: _get_no_of_follows ' + filename)
|
||||||
|
if lines is None:
|
||||||
|
return False
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if '#' in line:
|
if '#' in line:
|
||||||
|
|
@ -528,6 +537,9 @@ def get_following_feed(base_dir: str, domain: str, port: int, path: str,
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(filename,
|
load_list(filename,
|
||||||
'EX: get_following_feed ' + filename)
|
'EX: get_following_feed ' + filename)
|
||||||
|
if lines is None:
|
||||||
|
return following
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if '#' not in line:
|
if '#' not in line:
|
||||||
if '@' in line and not line.startswith('http'):
|
if '@' in line and not line.startswith('http'):
|
||||||
|
|
@ -612,6 +624,9 @@ def no_of_follow_requests(base_dir: str,
|
||||||
load_list(approve_follows_filename,
|
load_list(approve_follows_filename,
|
||||||
'EX: no_of_follow_requests ' +
|
'EX: no_of_follow_requests ' +
|
||||||
approve_follows_filename)
|
approve_follows_filename)
|
||||||
|
if lines is None:
|
||||||
|
return 0
|
||||||
|
|
||||||
if lines:
|
if lines:
|
||||||
if follow_type == "onion":
|
if follow_type == "onion":
|
||||||
for file_line in lines:
|
for file_line in lines:
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ def _meta_data_instance_v1(show_accounts: bool,
|
||||||
rules_lines = load_list(rules_filename,
|
rules_lines = load_list(rules_filename,
|
||||||
'EX: _meta_data_instance_v1 unable to read ' +
|
'EX: _meta_data_instance_v1 unable to read ' +
|
||||||
rules_filename)
|
rules_filename)
|
||||||
|
if rules_lines is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
rule_ctr = 1
|
rule_ctr = 1
|
||||||
for line in rules_lines:
|
for line in rules_lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ def _meta_data_instance_v2(show_accounts: bool,
|
||||||
rules_lines: list[str] = \
|
rules_lines: list[str] = \
|
||||||
load_list(rules_filename,
|
load_list(rules_filename,
|
||||||
'EX: _meta_data_instance_v2 unable to read rules')
|
'EX: _meta_data_instance_v2 unable to read rules')
|
||||||
|
if rules_lines is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
rule_ctr = 1
|
rule_ctr = 1
|
||||||
for line in rules_lines:
|
for line in rules_lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ def _move_following_handles_for_account(base_dir: str,
|
||||||
load_list(following_filename,
|
load_list(following_filename,
|
||||||
'EX: _move_following_handles_for_account unable to read ' +
|
'EX: _move_following_handles_for_account unable to read ' +
|
||||||
following_filename)
|
following_filename)
|
||||||
|
if following_handles is None:
|
||||||
|
return ctr
|
||||||
|
|
||||||
for follow_handle in following_handles:
|
for follow_handle in following_handles:
|
||||||
follow_handle = follow_handle.strip("\n").strip("\r")
|
follow_handle = follow_handle.strip("\n").strip("\r")
|
||||||
ctr += \
|
ctr += \
|
||||||
|
|
@ -155,6 +158,8 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(following_filename,
|
load_list(following_filename,
|
||||||
'EX: _update_moved_handle unable to read ' +
|
'EX: _update_moved_handle unable to read ' +
|
||||||
following_filename)
|
following_filename)
|
||||||
|
if following_handles is None:
|
||||||
|
return ctr
|
||||||
|
|
||||||
moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
|
moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
|
||||||
handle_lower = handle.lower()
|
handle_lower = handle.lower()
|
||||||
|
|
@ -205,6 +210,8 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(followers_filename,
|
load_list(followers_filename,
|
||||||
'EX: _update_moved_handle unable to read ' +
|
'EX: _update_moved_handle unable to read ' +
|
||||||
followers_filename)
|
followers_filename)
|
||||||
|
if follower_handles is None:
|
||||||
|
return ctr
|
||||||
|
|
||||||
handle_lower = handle.lower()
|
handle_lower = handle.lower()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,8 @@ def _newswire_hashtag_processing(base_dir: str, post_json_object: {},
|
||||||
load_list(rules_filename,
|
load_list(rules_filename,
|
||||||
'EX: _newswire_hashtag_processing unable to read ' +
|
'EX: _newswire_hashtag_processing unable to read ' +
|
||||||
rules_filename)
|
rules_filename)
|
||||||
|
if rules is None:
|
||||||
|
return True
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1827,6 +1827,9 @@ def get_dict_from_newswire(session, base_dir: str, domain: str,
|
||||||
load_list(subscriptions_filename,
|
load_list(subscriptions_filename,
|
||||||
'EX: get_dict_from_newswire unable to read ' +
|
'EX: get_dict_from_newswire unable to read ' +
|
||||||
subscriptions_filename)
|
subscriptions_filename)
|
||||||
|
if rss_feed is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
for url in rss_feed:
|
for url in rss_feed:
|
||||||
url = url.strip()
|
url = url.strip()
|
||||||
|
|
|
||||||
12
person.py
12
person.py
|
|
@ -1323,6 +1323,8 @@ def reenable_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
load_list(suspended_filename,
|
load_list(suspended_filename,
|
||||||
'EX: reenable_account unable to read ' +
|
'EX: reenable_account unable to read ' +
|
||||||
suspended_filename)
|
suspended_filename)
|
||||||
|
if lines is None:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
with open(suspended_filename, 'w+', encoding='utf-8') as fp_sus:
|
with open(suspended_filename, 'w+', encoding='utf-8') as fp_sus:
|
||||||
for suspended in lines:
|
for suspended in lines:
|
||||||
|
|
@ -1376,6 +1378,8 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
load_list(moderators_file,
|
load_list(moderators_file,
|
||||||
'EX: suspend_account unable too read ' +
|
'EX: suspend_account unable too read ' +
|
||||||
moderators_file)
|
moderators_file)
|
||||||
|
if lines is None:
|
||||||
|
return
|
||||||
for moderator in lines:
|
for moderator in lines:
|
||||||
if moderator.strip('\n').strip('\r') == nickname:
|
if moderator.strip('\n').strip('\r') == nickname:
|
||||||
return
|
return
|
||||||
|
|
@ -1400,6 +1404,8 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
load_list(suspended_filename,
|
load_list(suspended_filename,
|
||||||
'EX: suspend_account unable to read 2 ' +
|
'EX: suspend_account unable to read 2 ' +
|
||||||
suspended_filename)
|
suspended_filename)
|
||||||
|
if lines is None:
|
||||||
|
return
|
||||||
for suspended in lines:
|
for suspended in lines:
|
||||||
if suspended.strip('\n').strip('\r') == nickname:
|
if suspended.strip('\n').strip('\r') == nickname:
|
||||||
return
|
return
|
||||||
|
|
@ -1436,6 +1442,8 @@ def can_remove_post(base_dir: str,
|
||||||
load_list(moderators_file,
|
load_list(moderators_file,
|
||||||
'EX: can_remove_post unable to read ' +
|
'EX: can_remove_post unable to read ' +
|
||||||
moderators_file)
|
moderators_file)
|
||||||
|
if lines is None:
|
||||||
|
return False
|
||||||
for moderator in lines:
|
for moderator in lines:
|
||||||
if domain_full + '/users/' + \
|
if domain_full + '/users/' + \
|
||||||
moderator.strip('\n') + '/' in post_id:
|
moderator.strip('\n') + '/' in post_id:
|
||||||
|
|
@ -1470,6 +1478,8 @@ def _remove_tags_for_nickname(base_dir: str, nickname: str,
|
||||||
load_list(tag_filename,
|
load_list(tag_filename,
|
||||||
'EX: _remove_tags_for_nickname unable to read ' +
|
'EX: _remove_tags_for_nickname unable to read ' +
|
||||||
tag_filename)
|
tag_filename)
|
||||||
|
if lines is None:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
with open(tag_filename, 'w+', encoding='utf-8') as fp_tag:
|
with open(tag_filename, 'w+', encoding='utf-8') as fp_tag:
|
||||||
for tagline in lines:
|
for tagline in lines:
|
||||||
|
|
@ -1522,6 +1532,8 @@ def remove_account(base_dir: str, nickname: str,
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(moderators_file,
|
load_list(moderators_file,
|
||||||
'EX: remove_account unable to read ' + moderators_file)
|
'EX: remove_account unable to read ' + moderators_file)
|
||||||
|
if lines is None:
|
||||||
|
return False
|
||||||
for moderator in lines:
|
for moderator in lines:
|
||||||
if moderator.strip('\n') == nickname:
|
if moderator.strip('\n') == nickname:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
3
posts.py
3
posts.py
|
|
@ -2432,6 +2432,8 @@ def _append_citations_to_blog_post(base_dir: str,
|
||||||
load_list(citations_filename,
|
load_list(citations_filename,
|
||||||
'EX: _append_citations_to_blog_post unable to read ' +
|
'EX: _append_citations_to_blog_post unable to read ' +
|
||||||
citations_filename)
|
citations_filename)
|
||||||
|
if citations is None:
|
||||||
|
return
|
||||||
for line in citations:
|
for line in citations:
|
||||||
if citations_separator not in line:
|
if citations_separator not in line:
|
||||||
continue
|
continue
|
||||||
|
|
@ -4527,6 +4529,7 @@ def create_moderation(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
load_list(moderation_index_file,
|
load_list(moderation_index_file,
|
||||||
'EX: create_moderation unable to read ' +
|
'EX: create_moderation unable to read ' +
|
||||||
moderation_index_file)
|
moderation_index_file)
|
||||||
|
|
||||||
box_header['totalItems'] = len(lines)
|
box_header['totalItems'] = len(lines)
|
||||||
if header_only:
|
if header_only:
|
||||||
return box_header
|
return box_header
|
||||||
|
|
|
||||||
32
question.py
32
question.py
|
|
@ -147,17 +147,18 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
newlines: list[str] = []
|
newlines: list[str] = []
|
||||||
save_voters_file = False
|
save_voters_file = False
|
||||||
for vote_line in lines:
|
if lines:
|
||||||
if vote_line.startswith(actor_url +
|
for vote_line in lines:
|
||||||
voters_file_separator):
|
if vote_line.startswith(actor_url +
|
||||||
new_vote_line = actor_url + \
|
voters_file_separator):
|
||||||
voters_file_separator + reply_vote + '\n'
|
new_vote_line = actor_url + \
|
||||||
if vote_line == new_vote_line:
|
voters_file_separator + reply_vote + '\n'
|
||||||
break
|
if vote_line == new_vote_line:
|
||||||
save_voters_file = True
|
break
|
||||||
newlines.append(new_vote_line)
|
save_voters_file = True
|
||||||
else:
|
newlines.append(new_vote_line)
|
||||||
newlines.append(vote_line)
|
else:
|
||||||
|
newlines.append(vote_line)
|
||||||
if save_voters_file:
|
if save_voters_file:
|
||||||
try:
|
try:
|
||||||
with open(voters_filename, 'w+',
|
with open(voters_filename, 'w+',
|
||||||
|
|
@ -180,10 +181,11 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(voters_filename,
|
load_list(voters_filename,
|
||||||
'EX: question_update_votes unable to read ' +
|
'EX: question_update_votes unable to read ' +
|
||||||
voters_filename)
|
voters_filename)
|
||||||
for vote_line in lines:
|
if lines:
|
||||||
if vote_line.endswith(voters_file_separator +
|
for vote_line in lines:
|
||||||
possible_answer['name'] + '\n'):
|
if vote_line.endswith(voters_file_separator +
|
||||||
total_items += 1
|
possible_answer['name'] + '\n'):
|
||||||
|
total_items += 1
|
||||||
if possible_answer['replies']['totalItems'] != total_items:
|
if possible_answer['replies']['totalItems'] != total_items:
|
||||||
possible_answer['replies']['totalItems'] = total_items
|
possible_answer['replies']['totalItems'] = total_items
|
||||||
question_totals_changed = True
|
question_totals_changed = True
|
||||||
|
|
|
||||||
17
roles.py
17
roles.py
|
|
@ -60,6 +60,9 @@ def _add_role(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(role_file,
|
load_list(role_file,
|
||||||
'EX: _add_role, failed to read roles file ' + role_file)
|
'EX: _add_role, failed to read roles file ' + role_file)
|
||||||
|
|
||||||
|
if lines is None:
|
||||||
|
return
|
||||||
|
|
||||||
for role_nickname in lines:
|
for role_nickname in lines:
|
||||||
role_nickname = role_nickname.strip('\n').strip('\r')
|
role_nickname = role_nickname.strip('\n').strip('\r')
|
||||||
if role_nickname == nickname:
|
if role_nickname == nickname:
|
||||||
|
|
@ -97,6 +100,8 @@ def _remove_role(base_dir: str, nickname: str, role_filename: str) -> None:
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(role_file,
|
load_list(role_file,
|
||||||
'EX: _remove_role, failed to read roles file ' + role_file)
|
'EX: _remove_role, failed to read roles file ' + role_file)
|
||||||
|
if lines is None:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(role_file, 'w+', encoding='utf-8') as fp_role:
|
with open(role_file, 'w+', encoding='utf-8') as fp_role:
|
||||||
|
|
@ -281,6 +286,9 @@ def is_devops(base_dir: str, nickname: str) -> bool:
|
||||||
lines: list[str] = \
|
lines: list[str] = \
|
||||||
load_list(devops_file,
|
load_list(devops_file,
|
||||||
'EX: is_devops unable to read ' + devops_file)
|
'EX: is_devops unable to read ' + devops_file)
|
||||||
|
if lines is None:
|
||||||
|
return False
|
||||||
|
|
||||||
if not lines:
|
if not lines:
|
||||||
# if there is nothing in the file
|
# if there is nothing in the file
|
||||||
admin_name = get_config_param(base_dir, 'admin')
|
admin_name = get_config_param(base_dir, 'admin')
|
||||||
|
|
@ -288,10 +296,11 @@ def is_devops(base_dir: str, nickname: str) -> bool:
|
||||||
return False
|
return False
|
||||||
if admin_name == nickname:
|
if admin_name == nickname:
|
||||||
return True
|
return True
|
||||||
for devops in lines:
|
else:
|
||||||
devops = devops.strip('\n').strip('\r')
|
for devops in lines:
|
||||||
if devops == nickname:
|
devops = devops.strip('\n').strip('\r')
|
||||||
return True
|
if devops == nickname:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
2
tests.py
2
tests.py
|
|
@ -5767,6 +5767,7 @@ def _test_thread_functions():
|
||||||
if 'thread_with_trace(' in source_str:
|
if 'thread_with_trace(' in source_str:
|
||||||
threads_called_in_modules.append(mod_name)
|
threads_called_in_modules.append(mod_name)
|
||||||
lines: list[str] = load_list(source_file, '')
|
lines: list[str] = load_list(source_file, '')
|
||||||
|
assert lines is not None
|
||||||
modules[mod_name]['lines'] = lines
|
modules[mod_name]['lines'] = lines
|
||||||
|
|
||||||
for mod_name in threads_called_in_modules:
|
for mod_name in threads_called_in_modules:
|
||||||
|
|
@ -5926,6 +5927,7 @@ def _test_functions():
|
||||||
modules[mod_name]['source'] = source_str
|
modules[mod_name]['source'] = source_str
|
||||||
# go through the source line by line
|
# go through the source line by line
|
||||||
lines: list[str] = load_list(source_file, '')
|
lines: list[str] = load_list(source_file, '')
|
||||||
|
assert lines is not None
|
||||||
modules[mod_name]['lines'] = lines
|
modules[mod_name]['lines'] = lines
|
||||||
line_count = 0
|
line_count = 0
|
||||||
prev_line = 'start'
|
prev_line = 'start'
|
||||||
|
|
|
||||||
13
utils.py
13
utils.py
|
|
@ -1605,12 +1605,13 @@ def follow_person(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(unfollowed_filename,
|
load_list(unfollowed_filename,
|
||||||
'EX: follow_person unable to read ' +
|
'EX: follow_person unable to read ' +
|
||||||
unfollowed_filename)
|
unfollowed_filename)
|
||||||
for line in lines:
|
if lines is not None:
|
||||||
if handle_to_follow not in line:
|
for line in lines:
|
||||||
new_lines += line
|
if handle_to_follow not in line:
|
||||||
save_string(new_lines, unfollowed_filename,
|
new_lines += line
|
||||||
'EX: follow_person unable to write ' +
|
save_string(new_lines, unfollowed_filename,
|
||||||
unfollowed_filename)
|
'EX: follow_person unable to write ' +
|
||||||
|
unfollowed_filename)
|
||||||
|
|
||||||
dir_str = data_dir(base_dir)
|
dir_str = data_dir(base_dir)
|
||||||
if not os.path.isdir(dir_str):
|
if not os.path.isdir(dir_str):
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,8 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str,
|
||||||
load_list(links_filename,
|
load_list(links_filename,
|
||||||
'EX: get_left_column_content unable to read ' +
|
'EX: get_left_column_content unable to read ' +
|
||||||
links_filename)
|
links_filename)
|
||||||
|
if links_list is None:
|
||||||
|
links_list = []
|
||||||
|
|
||||||
if not front_page:
|
if not front_page:
|
||||||
# show a number of shares
|
# show a number of shares
|
||||||
|
|
|
||||||
|
|
@ -389,14 +389,15 @@ def html_citations(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(citations_filename,
|
load_list(citations_filename,
|
||||||
'EX: html_citations unable to read ' +
|
'EX: html_citations unable to read ' +
|
||||||
citations_filename + ' [ex]')
|
citations_filename + ' [ex]')
|
||||||
for line in citations:
|
if citations:
|
||||||
if citations_separator not in line:
|
for line in citations:
|
||||||
continue
|
if citations_separator not in line:
|
||||||
sections = line.strip().split(citations_separator)
|
continue
|
||||||
if len(sections) != 3:
|
sections = line.strip().split(citations_separator)
|
||||||
continue
|
if len(sections) != 3:
|
||||||
date_str = sections[0]
|
continue
|
||||||
citations_selected.append(date_str)
|
date_str = sections[0]
|
||||||
|
citations_selected.append(date_str)
|
||||||
|
|
||||||
# the css filename
|
# the css filename
|
||||||
css_filename = base_dir + '/epicyon-profile.css'
|
css_filename = base_dir + '/epicyon-profile.css'
|
||||||
|
|
|
||||||
|
|
@ -941,17 +941,18 @@ def html_new_post(edit_post_params: {},
|
||||||
load_list(citations_filename,
|
load_list(citations_filename,
|
||||||
'EX: html_new_post unable to read ' +
|
'EX: html_new_post unable to read ' +
|
||||||
citations_filename + ' [ex]')
|
citations_filename + ' [ex]')
|
||||||
for line in citations:
|
if citations:
|
||||||
if citations_separator not in line:
|
for line in citations:
|
||||||
continue
|
if citations_separator not in line:
|
||||||
sections = line.strip().split(citations_separator)
|
continue
|
||||||
if len(sections) != 3:
|
sections = line.strip().split(citations_separator)
|
||||||
continue
|
if len(sections) != 3:
|
||||||
title = sections[1]
|
continue
|
||||||
link = sections[2]
|
title = sections[1]
|
||||||
citations_str += \
|
link = sections[2]
|
||||||
' <li><a href="' + link + '"><cite>' + \
|
citations_str += \
|
||||||
title + '</cite></a></li>'
|
' <li><a href="' + link + '"><cite>' + \
|
||||||
|
title + '</cite></a></li>'
|
||||||
citations_str += ' </ul>\n'
|
citations_str += ' </ul>\n'
|
||||||
citations_str += '</div>\n'
|
citations_str += '</div>\n'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2761,24 +2761,25 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(locations_filename,
|
load_list(locations_filename,
|
||||||
'EX: _html_edit_profile_filtering unable to read ' +
|
'EX: _html_edit_profile_filtering unable to read ' +
|
||||||
locations_filename)
|
locations_filename)
|
||||||
cities.sort()
|
if cities:
|
||||||
edit_profile_form += ' <select id="cityDropdown" ' + \
|
cities.sort()
|
||||||
'name="cityDropdown" class="theme">\n'
|
edit_profile_form += ' <select id="cityDropdown" ' + \
|
||||||
city = city.lower()
|
'name="cityDropdown" class="theme">\n'
|
||||||
for city_name in cities:
|
city = city.lower()
|
||||||
if ':' not in city_name:
|
for city_name in cities:
|
||||||
continue
|
if ':' not in city_name:
|
||||||
city_selected = ''
|
continue
|
||||||
city_name = city_name.split(':')[0]
|
city_selected = ''
|
||||||
city_name = city_name.lower()
|
city_name = city_name.split(':')[0]
|
||||||
if city:
|
city_name = city_name.lower()
|
||||||
if city in city_name:
|
if city:
|
||||||
city_selected = ' selected'
|
if city in city_name:
|
||||||
edit_profile_form += \
|
city_selected = ' selected'
|
||||||
' <option value="' + city_name + \
|
edit_profile_form += \
|
||||||
'"' + city_selected + '>' + \
|
' <option value="' + city_name + \
|
||||||
city_name.title() + '</option>\n'
|
'"' + city_selected + '>' + \
|
||||||
edit_profile_form += ' </select><br>\n'
|
city_name.title() + '</option>\n'
|
||||||
|
edit_profile_form += ' </select><br>\n'
|
||||||
|
|
||||||
edit_profile_form += \
|
edit_profile_form += \
|
||||||
' <b><label class="labels">' + \
|
' <b><label class="labels">' + \
|
||||||
|
|
|
||||||
|
|
@ -932,6 +932,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
|
||||||
load_list(hashtag_index_file,
|
load_list(hashtag_index_file,
|
||||||
'EX: html_hashtag_search unable to read ' +
|
'EX: html_hashtag_search unable to read ' +
|
||||||
hashtag_index_file)
|
hashtag_index_file)
|
||||||
|
if lines is None:
|
||||||
|
return None
|
||||||
|
|
||||||
# read the css
|
# read the css
|
||||||
css_filename = base_dir + '/epicyon-profile.css'
|
css_filename = base_dir + '/epicyon-profile.css'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue