mirror of https://gitlab.com/bashrc2/epicyon
Include function name in exception
parent
94dd99d287
commit
5590d33d88
38
blocking.py
38
blocking.py
|
@ -554,7 +554,8 @@ def remove_global_block(base_dir: str,
|
||||||
os.rename(unblocking_filename + '.new',
|
os.rename(unblocking_filename + '.new',
|
||||||
unblocking_filename)
|
unblocking_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to rename ' + unblocking_filename)
|
print('EX: remove_global_block unable to rename ' +
|
||||||
|
unblocking_filename)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -580,7 +581,8 @@ def remove_global_block(base_dir: str,
|
||||||
os.rename(unblocking_filename + '.new',
|
os.rename(unblocking_filename + '.new',
|
||||||
unblocking_filename)
|
unblocking_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to rename 2 ' + unblocking_filename)
|
print('EX: remove_global_block unable to rename 2 ' +
|
||||||
|
unblocking_filename)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -615,7 +617,8 @@ def remove_block(base_dir: str, nickname: str, domain: str,
|
||||||
os.rename(unblocking_filename + '.new',
|
os.rename(unblocking_filename + '.new',
|
||||||
unblocking_filename)
|
unblocking_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to rename 3 ' + unblocking_filename)
|
print('EX: remove_block unable to rename 3 ' +
|
||||||
|
unblocking_filename)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -655,7 +658,8 @@ def get_domain_blocklist(base_dir: str) -> str:
|
||||||
encoding='utf-8') as fp_blocked:
|
encoding='utf-8') as fp_blocked:
|
||||||
blocked_str += fp_blocked.read()
|
blocked_str += fp_blocked.read()
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + global_blocking_filename)
|
print('EX: get_domain_blocklist unable to read ' +
|
||||||
|
global_blocking_filename)
|
||||||
return blocked_str
|
return blocked_str
|
||||||
|
|
||||||
|
|
||||||
|
@ -686,7 +690,8 @@ def update_blocked_cache(base_dir: str,
|
||||||
blocked_cache.clear()
|
blocked_cache.clear()
|
||||||
blocked_cache += blocked_lines
|
blocked_cache += blocked_lines
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to read ' + global_blocking_filename + ' ' + str(ex))
|
print('EX: update_blocked_cache unable to read ' +
|
||||||
|
global_blocking_filename + ' ' + str(ex))
|
||||||
return curr_time
|
return curr_time
|
||||||
|
|
||||||
|
|
||||||
|
@ -746,8 +751,8 @@ def is_blocked_domain(base_dir: str, domain: str,
|
||||||
if search_str_short in blocked_str:
|
if search_str_short in blocked_str:
|
||||||
return True
|
return True
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to read ' + global_blocking_filename +
|
print('EX: is_blocked_domain unable to read ' +
|
||||||
' ' + str(ex))
|
global_blocking_filename + ' ' + str(ex))
|
||||||
else:
|
else:
|
||||||
allow_filename = data_dir(base_dir) + '/allowedinstances.txt'
|
allow_filename = data_dir(base_dir) + '/allowedinstances.txt'
|
||||||
# instance allow list
|
# instance allow list
|
||||||
|
@ -782,8 +787,8 @@ def is_blocked_nickname(base_dir: str, nickname: str,
|
||||||
if search_str in blocked_str:
|
if search_str in blocked_str:
|
||||||
return True
|
return True
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to read ' + global_blocking_filename +
|
print('EX: is_blocked_nickname unable to read ' +
|
||||||
' ' + str(ex))
|
global_blocking_filename + ' ' + str(ex))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1124,12 +1129,14 @@ def outbox_block(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
nickname_blocked = get_nickname_from_actor(message_json['object'])
|
nickname_blocked = get_nickname_from_actor(message_json['object'])
|
||||||
if not nickname_blocked:
|
if not nickname_blocked:
|
||||||
print('WARN: unable to find nickname in ' + message_json['object'])
|
print('WARN: outbox_block unable to find nickname in ' +
|
||||||
|
message_json['object'])
|
||||||
return False
|
return False
|
||||||
domain_blocked, port_blocked = \
|
domain_blocked, port_blocked = \
|
||||||
get_domain_from_actor(message_json['object'])
|
get_domain_from_actor(message_json['object'])
|
||||||
if not domain_blocked:
|
if not domain_blocked:
|
||||||
print('WARN: unable to find domain in ' + message_json['object'])
|
print('WARN: outbox_block unable to find domain in ' +
|
||||||
|
message_json['object'])
|
||||||
return False
|
return False
|
||||||
domain_blocked_full = get_full_domain(domain_blocked, port_blocked)
|
domain_blocked_full = get_full_domain(domain_blocked, port_blocked)
|
||||||
|
|
||||||
|
@ -1184,13 +1191,13 @@ def outbox_undo_block(base_dir: str, nickname: str, domain: str,
|
||||||
nickname_blocked = \
|
nickname_blocked = \
|
||||||
get_nickname_from_actor(message_json['object']['object'])
|
get_nickname_from_actor(message_json['object']['object'])
|
||||||
if not nickname_blocked:
|
if not nickname_blocked:
|
||||||
print('WARN: unable to find nickname in ' +
|
print('WARN: outbox_undo_block unable to find nickname in ' +
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return
|
return
|
||||||
domain_object = message_json['object']['object']
|
domain_object = message_json['object']['object']
|
||||||
domain_blocked, port_blocked = get_domain_from_actor(domain_object)
|
domain_blocked, port_blocked = get_domain_from_actor(domain_object)
|
||||||
if not domain_blocked:
|
if not domain_blocked:
|
||||||
print('WARN: unable to find domain in ' +
|
print('WARN: outbox_undo_block unable to find domain in ' +
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return
|
return
|
||||||
domain_blocked_full = get_full_domain(domain_blocked, port_blocked)
|
domain_blocked_full = get_full_domain(domain_blocked, port_blocked)
|
||||||
|
@ -1506,7 +1513,8 @@ def outbox_mute(base_dir: str, http_prefix: str,
|
||||||
return
|
return
|
||||||
nickname_muted = get_nickname_from_actor(message_json['object'])
|
nickname_muted = get_nickname_from_actor(message_json['object'])
|
||||||
if not nickname_muted:
|
if not nickname_muted:
|
||||||
print('WARN: unable to find nickname in ' + message_json['object'])
|
print('WARN: outbox_mute unable to find nickname in ' +
|
||||||
|
message_json['object'])
|
||||||
return
|
return
|
||||||
|
|
||||||
mute_post(base_dir, nickname, domain, port,
|
mute_post(base_dir, nickname, domain, port,
|
||||||
|
@ -1570,7 +1578,7 @@ def outbox_undo_mute(base_dir: str, http_prefix: str,
|
||||||
return
|
return
|
||||||
nickname_muted = get_nickname_from_actor(message_json['object']['object'])
|
nickname_muted = get_nickname_from_actor(message_json['object']['object'])
|
||||||
if not nickname_muted:
|
if not nickname_muted:
|
||||||
print('WARN: unable to find nickname in ' +
|
print('WARN: outbox_undo_mute unable to find nickname in ' +
|
||||||
message_json['object']['object'])
|
message_json['object']['object'])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
3
blog.py
3
blog.py
|
@ -806,7 +806,8 @@ def html_edit_blog(media_instance: bool, translate: {},
|
||||||
with open(dir_str + '/newpost.txt', 'r', encoding='utf-8') as file:
|
with open(dir_str + '/newpost.txt', 'r', encoding='utf-8') as file:
|
||||||
edit_blog_text = '<p>' + file.read() + '</p>'
|
edit_blog_text = '<p>' + file.read() + '</p>'
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + dir_str + '/newpost.txt')
|
print('EX: html_edit_blog unable to read ' +
|
||||||
|
dir_str + '/newpost.txt')
|
||||||
|
|
||||||
css_filename = base_dir + '/epicyon-profile.css'
|
css_filename = base_dir + '/epicyon-profile.css'
|
||||||
if os.path.isfile(base_dir + '/epicyon.css'):
|
if os.path.isfile(base_dir + '/epicyon.css'):
|
||||||
|
|
|
@ -84,7 +84,8 @@ def undo_bookmarks_collection_entry(recent_posts_cache: {},
|
||||||
encoding='utf-8') as index_file:
|
encoding='utf-8') as index_file:
|
||||||
index_str = index_file.read().replace(bookmark_index + '\n', '')
|
index_str = index_file.read().replace(bookmark_index + '\n', '')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + bookmarks_index_filename)
|
print('EX: undo_bookmarks_collection_entry unable to read ' +
|
||||||
|
bookmarks_index_filename)
|
||||||
if index_str:
|
if index_str:
|
||||||
try:
|
try:
|
||||||
with open(bookmarks_index_filename, 'w+',
|
with open(bookmarks_index_filename, 'w+',
|
||||||
|
|
4
city.py
4
city.py
|
@ -241,7 +241,7 @@ def spoof_geolocation(base_dir: str,
|
||||||
with open(nogo_filename, 'r', encoding='utf-8') as nogo_file:
|
with open(nogo_filename, 'r', encoding='utf-8') as nogo_file:
|
||||||
nogo_list = nogo_file.readlines()
|
nogo_list = nogo_file.readlines()
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + nogo_filename)
|
print('EX: spoof_geolocation unable to read ' + nogo_filename)
|
||||||
for line in nogo_list:
|
for line in nogo_list:
|
||||||
if line.startswith(city + ':'):
|
if line.startswith(city + ':'):
|
||||||
polygon = parse_nogo_string(line)
|
polygon = parse_nogo_string(line)
|
||||||
|
@ -338,7 +338,7 @@ def get_spoofed_city(city: str, base_dir: str,
|
||||||
city1 = city_file.read()
|
city1 = city_file.read()
|
||||||
city = remove_eol(city1)
|
city = remove_eol(city1)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + city_filename)
|
print('EX: get_spoofed_city unable to read ' + city_filename)
|
||||||
return city
|
return city
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1384,7 +1384,8 @@ def add_html_tags(base_dir: str, http_prefix: str,
|
||||||
encoding='utf-8') as foll_file:
|
encoding='utf-8') as foll_file:
|
||||||
following = foll_file.readlines()
|
following = foll_file.readlines()
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + following_filename)
|
print('EX: add_html_tags unable to read ' +
|
||||||
|
following_filename)
|
||||||
for handle in following:
|
for handle in following:
|
||||||
pet = get_pet_name(base_dir, nickname, domain, handle)
|
pet = get_pet_name(base_dir, nickname, domain, handle)
|
||||||
if pet:
|
if pet:
|
||||||
|
@ -1695,7 +1696,7 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
||||||
with open(filename, 'wb') as fp_media:
|
with open(filename, 'wb') as fp_media:
|
||||||
fp_media.write(media_bytes[start_pos:])
|
fp_media.write(media_bytes[start_pos:])
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write media')
|
print('EX: save_media_in_form_post unable to write media')
|
||||||
|
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
print('WARN: Media file could not be written to file: ' + filename)
|
print('WARN: Media file could not be written to file: ' + filename)
|
||||||
|
|
|
@ -71,7 +71,7 @@ def receive_image_attachment(self, length: int, path: str, base_dir: str,
|
||||||
with open(media_filename, 'wb') as av_file:
|
with open(media_filename, 'wb') as av_file:
|
||||||
av_file.write(media_bytes)
|
av_file.write(media_bytes)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + media_filename)
|
print('EX: receive_image_attachment unable to write ' + media_filename)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: image saved to ' + media_filename)
|
print('DEBUG: image saved to ' + media_filename)
|
||||||
self.send_response(201)
|
self.send_response(201)
|
||||||
|
|
|
@ -148,7 +148,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as filterfile:
|
encoding='utf-8') as filterfile:
|
||||||
filterfile.write(fields['filteredWordsNewswire'])
|
filterfile.write(fields['filteredWordsNewswire'])
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + filter_newswire_filename)
|
print('EX: newswire_update unable to write ' +
|
||||||
|
filter_newswire_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(filter_newswire_filename):
|
if os.path.isfile(filter_newswire_filename):
|
||||||
try:
|
try:
|
||||||
|
@ -165,7 +166,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as fp_dogwhistles:
|
encoding='utf-8') as fp_dogwhistles:
|
||||||
fp_dogwhistles.write(fields['dogwhistleWords'])
|
fp_dogwhistles.write(fields['dogwhistleWords'])
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + dogwhistles_filename)
|
print('EX: newswire_update unable to write 2 ' +
|
||||||
|
dogwhistles_filename)
|
||||||
self.server.dogwhistles = \
|
self.server.dogwhistles = \
|
||||||
load_dogwhistles(dogwhistles_filename)
|
load_dogwhistles(dogwhistles_filename)
|
||||||
else:
|
else:
|
||||||
|
@ -175,7 +177,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as fp_dogwhistles:
|
encoding='utf-8') as fp_dogwhistles:
|
||||||
fp_dogwhistles.write('')
|
fp_dogwhistles.write('')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + dogwhistles_filename)
|
print('EX: newswire_update unable unable to write 3 ' +
|
||||||
|
dogwhistles_filename)
|
||||||
self.server.dogwhistles = {}
|
self.server.dogwhistles = {}
|
||||||
|
|
||||||
# save news tagging rules
|
# save news tagging rules
|
||||||
|
@ -186,7 +189,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as rulesfile:
|
encoding='utf-8') as rulesfile:
|
||||||
rulesfile.write(fields['hashtagRulesList'])
|
rulesfile.write(fields['hashtagRulesList'])
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + hashtag_rules_filename)
|
print('EX: newswire_update unable to write 4 ' +
|
||||||
|
hashtag_rules_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(hashtag_rules_filename):
|
if os.path.isfile(hashtag_rules_filename):
|
||||||
try:
|
try:
|
||||||
|
@ -205,7 +209,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as trustfile:
|
encoding='utf-8') as trustfile:
|
||||||
trustfile.write(newswire_trusted)
|
trustfile.write(newswire_trusted)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + newswire_tusted_filename)
|
print('EX: newswire_update unable to write 5 ' +
|
||||||
|
newswire_tusted_filename)
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(newswire_tusted_filename):
|
if os.path.isfile(newswire_tusted_filename):
|
||||||
try:
|
try:
|
||||||
|
@ -311,7 +316,8 @@ def citations_update(self, calling_domain: str, cookie: str,
|
||||||
encoding='utf-8') as citfile:
|
encoding='utf-8') as citfile:
|
||||||
citfile.write(citations_str)
|
citfile.write(citations_str)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + citations_filename)
|
print('EX: citations_update unable to write ' +
|
||||||
|
citations_filename)
|
||||||
|
|
||||||
# redirect back to the default timeline
|
# redirect back to the default timeline
|
||||||
redirect_headers(self, actor_str + '/newblog',
|
redirect_headers(self, actor_str + '/newblog',
|
||||||
|
|
|
@ -601,8 +601,8 @@ def _person_options_post_to_news(self, options_confirm_params: str,
|
||||||
nofile.write('\n')
|
nofile.write('\n')
|
||||||
nw_written = True
|
nw_written = True
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to write ' + nw_filename +
|
print('EX: _person_options_post_to_news unable ' +
|
||||||
' ' + str(ex))
|
'to write ' + nw_filename + ' ' + str(ex))
|
||||||
if nw_written:
|
if nw_written:
|
||||||
refresh_newswire(base_dir)
|
refresh_newswire(base_dir)
|
||||||
users_path_str = \
|
users_path_str = \
|
||||||
|
@ -661,7 +661,8 @@ def _person_options_post_to_features(self, options_confirm_params: str,
|
||||||
nofile.write('\n')
|
nofile.write('\n')
|
||||||
feat_written = True
|
feat_written = True
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to write ' + feat_filename +
|
print('EX: _person_options_post_to_features ' +
|
||||||
|
'unable to write ' + feat_filename +
|
||||||
' ' + str(ex))
|
' ' + str(ex))
|
||||||
if feat_written:
|
if feat_written:
|
||||||
refresh_newswire(base_dir)
|
refresh_newswire(base_dir)
|
||||||
|
@ -718,7 +719,8 @@ def _person_options_mod_news(self, options_confirm_params: str,
|
||||||
encoding='utf-8') as modfile:
|
encoding='utf-8') as modfile:
|
||||||
modfile.write('\n')
|
modfile.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + nw_filename)
|
print('EX: _person_options_mod_news ' +
|
||||||
|
'unable to write ' + nw_filename)
|
||||||
users_path_str = \
|
users_path_str = \
|
||||||
users_path + '/' + default_timeline + \
|
users_path + '/' + default_timeline + \
|
||||||
'?page=' + str(page_number)
|
'?page=' + str(page_number)
|
||||||
|
|
12
follow.py
12
follow.py
|
@ -354,7 +354,8 @@ def unfollow_account(base_dir: str, nickname: str, domain: str,
|
||||||
'!' + handle_to_unfollow_lower):
|
'!' + handle_to_unfollow_lower):
|
||||||
fp_unfoll.write(line)
|
fp_unfoll.write(line)
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to write ' + filename + ' ' + str(ex))
|
print('EX: unfollow_account unable to write ' +
|
||||||
|
filename + ' ' + str(ex))
|
||||||
|
|
||||||
# write to an unfollowed file so that if a follow accept
|
# write to an unfollowed file so that if a follow accept
|
||||||
# later arrives then it can be ignored
|
# later arrives then it can be ignored
|
||||||
|
@ -367,14 +368,16 @@ def unfollow_account(base_dir: str, nickname: str, domain: str,
|
||||||
encoding='utf-8') as fp_unfoll:
|
encoding='utf-8') as fp_unfoll:
|
||||||
fp_unfoll.write(handle_to_unfollow + '\n')
|
fp_unfoll.write(handle_to_unfollow + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + unfollowed_filename)
|
print('EX: unfollow_account unable to append ' +
|
||||||
|
unfollowed_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(unfollowed_filename, 'w+',
|
with open(unfollowed_filename, 'w+',
|
||||||
encoding='utf-8') as fp_unfoll:
|
encoding='utf-8') as fp_unfoll:
|
||||||
fp_unfoll.write(handle_to_unfollow + '\n')
|
fp_unfoll.write(handle_to_unfollow + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + unfollowed_filename)
|
print('EX: unfollow_account unable to write ' +
|
||||||
|
unfollowed_filename)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -982,7 +985,8 @@ def send_follow_request(session, base_dir: str,
|
||||||
encoding='utf-8') as fp_unfoll:
|
encoding='utf-8') as fp_unfoll:
|
||||||
fp_unfoll.write(unfollowed_file)
|
fp_unfoll.write(unfollowed_file)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + unfollowed_filename)
|
print('EX: send_follow_request unable to write ' +
|
||||||
|
unfollowed_filename)
|
||||||
|
|
||||||
new_follow_json = {
|
new_follow_json = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
|
|
|
@ -140,7 +140,8 @@ def _receive_calendar_events(base_dir: str, nickname: str, domain: str,
|
||||||
encoding='utf-8') as fp_cal:
|
encoding='utf-8') as fp_cal:
|
||||||
fp_cal.write(following_handles + handle + '\n')
|
fp_cal.write(following_handles + handle + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + calendar_filename)
|
print('EX: _receive_calendar_events unable to write ' +
|
||||||
|
calendar_filename)
|
||||||
|
|
||||||
# already in the calendar file?
|
# already in the calendar file?
|
||||||
if handle + '\n' in following_handles or \
|
if handle + '\n' in following_handles or \
|
||||||
|
|
|
@ -158,7 +158,8 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
|
||||||
encoding='utf-8') as tl_events_file:
|
encoding='utf-8') as tl_events_file:
|
||||||
tl_events_file.write(event_id + '\n')
|
tl_events_file.write(event_id + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + tl_events_filename)
|
print('EX: save_event_post unable to write ' +
|
||||||
|
tl_events_filename)
|
||||||
|
|
||||||
# create a directory for the calendar year
|
# create a directory for the calendar year
|
||||||
if not os.path.isdir(calendar_path + '/' + str(event_year)):
|
if not os.path.isdir(calendar_path + '/' + str(event_year)):
|
||||||
|
@ -191,7 +192,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
|
||||||
with open(cal_notify_filename, 'w+', encoding='utf-8') as cal_file:
|
with open(cal_notify_filename, 'w+', encoding='utf-8') as cal_file:
|
||||||
cal_file.write(notify_str)
|
cal_file.write(notify_str)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + cal_notify_filename)
|
print('EX: save_event_post unable to write ' + cal_notify_filename)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
38
inbox.py
38
inbox.py
|
@ -426,7 +426,7 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str,
|
||||||
tags_file.write(tag_line)
|
tags_file.write(tag_line)
|
||||||
hashtag_added = True
|
hashtag_added = True
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + tags_filename)
|
print('EX: store_hash_tags unable to write ' + tags_filename)
|
||||||
else:
|
else:
|
||||||
content = ''
|
content = ''
|
||||||
try:
|
try:
|
||||||
|
@ -1340,7 +1340,8 @@ def _person_receive_update(base_dir: str,
|
||||||
refollow_str = fp_refollow.read()
|
refollow_str = fp_refollow.read()
|
||||||
refollow_file_exists = True
|
refollow_file_exists = True
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to read ' + refollow_filename)
|
print('EX: _person_receive_update unable to read ' +
|
||||||
|
refollow_filename)
|
||||||
if new_actor not in refollow_str:
|
if new_actor not in refollow_str:
|
||||||
refollow_type = 'w+'
|
refollow_type = 'w+'
|
||||||
if refollow_file_exists:
|
if refollow_file_exists:
|
||||||
|
@ -1350,7 +1351,7 @@ def _person_receive_update(base_dir: str,
|
||||||
encoding='utf-8') as fp_refollow:
|
encoding='utf-8') as fp_refollow:
|
||||||
fp_refollow.write(new_actor + '\n')
|
fp_refollow.write(new_actor + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write to ' +
|
print('EX: _person_receive_update unable to write to ' +
|
||||||
refollow_filename)
|
refollow_filename)
|
||||||
prev_avatar_url = \
|
prev_avatar_url = \
|
||||||
get_person_avatar_url(base_dir, person_json['id'],
|
get_person_avatar_url(base_dir, person_json['id'],
|
||||||
|
@ -3704,14 +3705,16 @@ def populate_replies(base_dir: str, http_prefix: str, domain: str,
|
||||||
encoding='utf-8') as replies_file:
|
encoding='utf-8') as replies_file:
|
||||||
replies_file.write(message_id + '\n')
|
replies_file.write(message_id + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + post_replies_filename)
|
print('EX: populate_replies unable to append ' +
|
||||||
|
post_replies_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(post_replies_filename, 'w+',
|
with open(post_replies_filename, 'w+',
|
||||||
encoding='utf-8') as replies_file:
|
encoding='utf-8') as replies_file:
|
||||||
replies_file.write(message_id + '\n')
|
replies_file.write(message_id + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + post_replies_filename)
|
print('EX: populate_replies unable to write ' +
|
||||||
|
post_replies_filename)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -3802,7 +3805,7 @@ def _dm_notify(base_dir: str, handle: str, url: str) -> None:
|
||||||
with open(dm_file, 'w+', encoding='utf-8') as fp_dm:
|
with open(dm_file, 'w+', encoding='utf-8') as fp_dm:
|
||||||
fp_dm.write(url)
|
fp_dm.write(url)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + dm_file)
|
print('EX: _dm_notify unable to write ' + dm_file)
|
||||||
|
|
||||||
|
|
||||||
def _already_liked(base_dir: str, nickname: str, domain: str,
|
def _already_liked(base_dir: str, nickname: str, domain: str,
|
||||||
|
@ -4020,7 +4023,7 @@ def _notify_post_arrival(base_dir: str, handle: str, url: str) -> None:
|
||||||
with open(notify_file, 'w+', encoding='utf-8') as fp_notify:
|
with open(notify_file, 'w+', encoding='utf-8') as fp_notify:
|
||||||
fp_notify.write(url)
|
fp_notify.write(url)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + notify_file)
|
print('EX: _notify_post_arrival unable to write ' + notify_file)
|
||||||
|
|
||||||
|
|
||||||
def _reply_notify(base_dir: str, handle: str, url: str) -> None:
|
def _reply_notify(base_dir: str, handle: str, url: str) -> None:
|
||||||
|
@ -4035,7 +4038,7 @@ def _reply_notify(base_dir: str, handle: str, url: str) -> None:
|
||||||
with open(reply_file, 'w+', encoding='utf-8') as fp_reply:
|
with open(reply_file, 'w+', encoding='utf-8') as fp_reply:
|
||||||
fp_reply.write(url)
|
fp_reply.write(url)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + reply_file)
|
print('EX: _reply_notify unable to write ' + reply_file)
|
||||||
|
|
||||||
|
|
||||||
def _git_patch_notify(base_dir: str, handle: str, subject: str,
|
def _git_patch_notify(base_dir: str, handle: str, subject: str,
|
||||||
|
@ -4052,7 +4055,7 @@ def _git_patch_notify(base_dir: str, handle: str, subject: str,
|
||||||
with open(patch_file, 'w+', encoding='utf-8') as fp_patch:
|
with open(patch_file, 'w+', encoding='utf-8') as fp_patch:
|
||||||
fp_patch.write('git ' + handle + ' ' + subject)
|
fp_patch.write('git ' + handle + ' ' + subject)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + patch_file)
|
print('EX: _git_patch_notify unable to write ' + patch_file)
|
||||||
|
|
||||||
|
|
||||||
def _group_handle(base_dir: str, handle: str) -> bool:
|
def _group_handle(base_dir: str, handle: str) -> bool:
|
||||||
|
@ -4305,7 +4308,7 @@ def _update_last_seen(base_dir: str, handle: str, actor: str) -> None:
|
||||||
encoding='utf-8') as last_seen_file:
|
encoding='utf-8') as last_seen_file:
|
||||||
last_seen_file.write(str(days_since_epoch))
|
last_seen_file.write(str(days_since_epoch))
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + last_seen_filename)
|
print('EX: _update_last_seen unable to write ' + last_seen_filename)
|
||||||
|
|
||||||
|
|
||||||
def _bounce_dm(sender_post_id: str, session, http_prefix: str,
|
def _bounce_dm(sender_post_id: str, session, http_prefix: str,
|
||||||
|
@ -5434,7 +5437,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
||||||
encoding='utf-8') as mitm_file:
|
encoding='utf-8') as mitm_file:
|
||||||
mitm_file.write('\n')
|
mitm_file.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + destination_filename_mitm)
|
print('EX: _inbox_after_initial unable to write ' +
|
||||||
|
destination_filename_mitm)
|
||||||
|
|
||||||
_low_frequency_post_notification(base_dir, http_prefix,
|
_low_frequency_post_notification(base_dir, http_prefix,
|
||||||
nickname, domain, port,
|
nickname, domain, port,
|
||||||
|
@ -5454,7 +5458,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
||||||
encoding='utf-8') as mute_file:
|
encoding='utf-8') as mute_file:
|
||||||
mute_file.write('\n')
|
mute_file.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + destination_filename_muted)
|
print('EX: _inbox_after_initial unable to write 2 ' +
|
||||||
|
destination_filename_muted)
|
||||||
|
|
||||||
# is this an edit of a previous post?
|
# is this an edit of a previous post?
|
||||||
# in Mastodon "delete and redraft"
|
# in Mastodon "delete and redraft"
|
||||||
|
@ -5899,7 +5904,8 @@ def _check_json_signature(base_dir: str, queue_json: {}) -> (bool, bool):
|
||||||
encoding='utf-8') as unknown_file:
|
encoding='utf-8') as unknown_file:
|
||||||
unknown_file.write(unknown_context + '\n')
|
unknown_file.write(unknown_context + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + unknown_contexts_file)
|
print('EX: _check_json_signature unable to append ' +
|
||||||
|
unknown_contexts_file)
|
||||||
else:
|
else:
|
||||||
print('Unrecognized jsonld signature type: ' + jwebsig_type)
|
print('Unrecognized jsonld signature type: ' + jwebsig_type)
|
||||||
|
|
||||||
|
@ -5917,7 +5923,8 @@ def _check_json_signature(base_dir: str, queue_json: {}) -> (bool, bool):
|
||||||
encoding='utf-8') as unknown_file:
|
encoding='utf-8') as unknown_file:
|
||||||
unknown_file.write(jwebsig_type + '\n')
|
unknown_file.write(jwebsig_type + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + unknown_signatures_file)
|
print('EX: _check_json_signature unable to append ' +
|
||||||
|
unknown_signatures_file)
|
||||||
return has_json_signature, jwebsig_type
|
return has_json_signature, jwebsig_type
|
||||||
|
|
||||||
|
|
||||||
|
@ -6199,7 +6206,8 @@ def _receive_follow_request(session, session_onion, session_i2p,
|
||||||
encoding='utf-8') as followers_file:
|
encoding='utf-8') as followers_file:
|
||||||
followers_file.write(approve_handle + '\n')
|
followers_file.write(approve_handle + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + followers_filename)
|
print('EX: _receive_follow_request unable to write ' +
|
||||||
|
followers_filename)
|
||||||
else:
|
else:
|
||||||
print('ACCEPT: Follow Accept account directory not found: ' +
|
print('ACCEPT: Follow Accept account directory not found: ' +
|
||||||
account_to_be_followed)
|
account_to_be_followed)
|
||||||
|
|
|
@ -61,7 +61,8 @@ def manual_deny_follow_request(session, session_onion, session_i2p,
|
||||||
encoding='utf-8') as rejects_file:
|
encoding='utf-8') as rejects_file:
|
||||||
rejects_file.write(deny_handle + '\n')
|
rejects_file.write(deny_handle + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + rejected_follows_filename)
|
print('EX: manual_deny_follow_request unable to append ' +
|
||||||
|
rejected_follows_filename)
|
||||||
|
|
||||||
deny_nickname = deny_handle.split('@')[0]
|
deny_nickname = deny_handle.split('@')[0]
|
||||||
deny_domain = remove_eol(deny_handle.split('@')[1])
|
deny_domain = remove_eol(deny_handle.split('@')[1])
|
||||||
|
@ -136,14 +137,16 @@ def _approve_follower_handle(account_dir: str, approve_handle: str) -> None:
|
||||||
encoding='utf-8') as approved_file:
|
encoding='utf-8') as approved_file:
|
||||||
approved_file.write(approve_handle + '\n')
|
approved_file.write(approve_handle + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + approved_filename)
|
print('EX: _approve_follower_handle unable to append ' +
|
||||||
|
approved_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(approved_filename, 'w+',
|
with open(approved_filename, 'w+',
|
||||||
encoding='utf-8') as approved_file:
|
encoding='utf-8') as approved_file:
|
||||||
approved_file.write(approve_handle + '\n')
|
approved_file.write(approve_handle + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + approved_filename)
|
print('EX: _approve_follower_handle unable to write ' +
|
||||||
|
approved_filename)
|
||||||
|
|
||||||
|
|
||||||
def manual_approve_follow_request(session, session_onion, session_i2p,
|
def manual_approve_follow_request(session, session_onion, session_i2p,
|
||||||
|
@ -334,7 +337,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
|
||||||
encoding='utf-8') as followers_file:
|
encoding='utf-8') as followers_file:
|
||||||
followers_file.write(approve_handle_full + '\n')
|
followers_file.write(approve_handle_full + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + followers_filename)
|
print('EX: manual_approve_follow_request unable to write ' +
|
||||||
|
followers_filename)
|
||||||
|
|
||||||
# only update the follow requests file if the follow is confirmed to be
|
# only update the follow requests file if the follow is confirmed to be
|
||||||
# in followers.txt
|
# in followers.txt
|
||||||
|
|
|
@ -67,7 +67,8 @@ def _update_feeds_outbox_index(base_dir: str, domain: str,
|
||||||
with open(index_filename, 'w+', encoding='utf-8') as feeds_file:
|
with open(index_filename, 'w+', encoding='utf-8') as feeds_file:
|
||||||
feeds_file.write(post_id + '\n')
|
feeds_file.write(post_id + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + index_filename)
|
print('EX: _update_feeds_outbox_index unable to write ' +
|
||||||
|
index_filename)
|
||||||
|
|
||||||
|
|
||||||
def _save_arrived_time(post_filename: str, arrived: str) -> None:
|
def _save_arrived_time(post_filename: str, arrived: str) -> None:
|
||||||
|
@ -78,7 +79,8 @@ def _save_arrived_time(post_filename: str, arrived: str) -> None:
|
||||||
encoding='utf-8') as arrived_file:
|
encoding='utf-8') as arrived_file:
|
||||||
arrived_file.write(arrived)
|
arrived_file.write(arrived)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + post_filename + '.arrived')
|
print('EX: _save_arrived_time unable to write ' +
|
||||||
|
post_filename + '.arrived')
|
||||||
|
|
||||||
|
|
||||||
def _remove_control_characters(content: str) -> str:
|
def _remove_control_characters(content: str) -> str:
|
||||||
|
@ -499,7 +501,8 @@ def _create_news_mirror(base_dir: str, domain: str,
|
||||||
encoding='utf-8') as index_file:
|
encoding='utf-8') as index_file:
|
||||||
index_file.write(index_content)
|
index_file.write(index_content)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + mirror_index_filename)
|
print('EX: _create_news_mirror unable to write ' +
|
||||||
|
mirror_index_filename)
|
||||||
|
|
||||||
mirror_article_dir = mirror_dir + '/' + post_id_number
|
mirror_article_dir = mirror_dir + '/' + post_id_number
|
||||||
if os.path.isdir(mirror_article_dir):
|
if os.path.isdir(mirror_article_dir):
|
||||||
|
@ -529,14 +532,16 @@ def _create_news_mirror(base_dir: str, domain: str,
|
||||||
encoding='utf-8') as index_file:
|
encoding='utf-8') as index_file:
|
||||||
index_file.write(post_id_number + '\n')
|
index_file.write(post_id_number + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + mirror_index_filename)
|
print('EX: _create_news_mirror unable to append ' +
|
||||||
|
mirror_index_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(mirror_index_filename, 'w+',
|
with open(mirror_index_filename, 'w+',
|
||||||
encoding='utf-8') as index_file:
|
encoding='utf-8') as index_file:
|
||||||
index_file.write(post_id_number + '\n')
|
index_file.write(post_id_number + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + mirror_index_filename)
|
print('EX: _create_news_mirror unable to write ' +
|
||||||
|
mirror_index_filename)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
30
person.py
30
person.py
|
@ -608,7 +608,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
with open(filename, 'w+', encoding='utf-8') as text_file:
|
with open(filename, 'w+', encoding='utf-8') as text_file:
|
||||||
print(private_key_pem, file=text_file)
|
print(private_key_pem, file=text_file)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to save ' + filename)
|
print('EX: _create_person_base unable to save ' + filename)
|
||||||
|
|
||||||
# save the public key
|
# save the public key
|
||||||
public_keys_subdir = '/keys/public'
|
public_keys_subdir = '/keys/public'
|
||||||
|
@ -619,7 +619,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
with open(filename, 'w+', encoding='utf-8') as text_file:
|
with open(filename, 'w+', encoding='utf-8') as text_file:
|
||||||
print(public_key_pem, file=text_file)
|
print(public_key_pem, file=text_file)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to save 2 ' + filename)
|
print('EX: _create_person_base unable to save 2 ' + filename)
|
||||||
|
|
||||||
if password:
|
if password:
|
||||||
password = remove_eol(password).strip()
|
password = remove_eol(password).strip()
|
||||||
|
@ -765,7 +765,7 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
with open(follow_dms_filename, 'w+', encoding='utf-8') as ffile:
|
with open(follow_dms_filename, 'w+', encoding='utf-8') as ffile:
|
||||||
ffile.write('\n')
|
ffile.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + follow_dms_filename)
|
print('EX: create_person unable to write ' + follow_dms_filename)
|
||||||
|
|
||||||
# notify when posts are liked
|
# notify when posts are liked
|
||||||
if nickname != 'news':
|
if nickname != 'news':
|
||||||
|
@ -775,7 +775,8 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
with open(notify_likes_filename, 'w+', encoding='utf-8') as nfile:
|
with open(notify_likes_filename, 'w+', encoding='utf-8') as nfile:
|
||||||
nfile.write('\n')
|
nfile.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + notify_likes_filename)
|
print('EX: create_person unable to write 2 ' +
|
||||||
|
notify_likes_filename)
|
||||||
|
|
||||||
# notify when posts have emoji reactions
|
# notify when posts have emoji reactions
|
||||||
if nickname != 'news':
|
if nickname != 'news':
|
||||||
|
@ -786,7 +787,8 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
encoding='utf-8') as nfile:
|
encoding='utf-8') as nfile:
|
||||||
nfile.write('\n')
|
nfile.write('\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + notify_reactions_filename)
|
print('EX: create_person unable to write 3 ' +
|
||||||
|
notify_reactions_filename)
|
||||||
|
|
||||||
theme = get_config_param(base_dir, 'theme')
|
theme = get_config_param(base_dir, 'theme')
|
||||||
if not theme:
|
if not theme:
|
||||||
|
@ -1279,8 +1281,8 @@ def reenable_account(base_dir: str, nickname: str) -> None:
|
||||||
if suspended.strip('\n').strip('\r') != nickname:
|
if suspended.strip('\n').strip('\r') != nickname:
|
||||||
fp_sus.write(suspended)
|
fp_sus.write(suspended)
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
print('EX: unable to save ' + suspended_filename +
|
print('EX: reenable_account unable to save ' +
|
||||||
' ' + str(ex))
|
suspended_filename + ' ' + str(ex))
|
||||||
|
|
||||||
|
|
||||||
def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
|
@ -1313,7 +1315,7 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
try:
|
try:
|
||||||
os.remove(token_filename)
|
os.remove(token_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: suspend_account unable to delete ' + token_filename)
|
print('EX: suspend_account unable to delete 2 ' + token_filename)
|
||||||
|
|
||||||
suspended_filename = data_dir(base_dir) + '/suspended.txt'
|
suspended_filename = data_dir(base_dir) + '/suspended.txt'
|
||||||
if os.path.isfile(suspended_filename):
|
if os.path.isfile(suspended_filename):
|
||||||
|
@ -1326,13 +1328,13 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
with open(suspended_filename, 'a+', encoding='utf-8') as fp_sus:
|
with open(suspended_filename, 'a+', encoding='utf-8') as fp_sus:
|
||||||
fp_sus.write(nickname + '\n')
|
fp_sus.write(nickname + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + suspended_filename)
|
print('EX: suspend_account unable to append ' + suspended_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(suspended_filename, 'w+', encoding='utf-8') as fp_sus:
|
with open(suspended_filename, 'w+', encoding='utf-8') as fp_sus:
|
||||||
fp_sus.write(nickname + '\n')
|
fp_sus.write(nickname + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + suspended_filename)
|
print('EX: suspend_account unable to write ' + suspended_filename)
|
||||||
|
|
||||||
|
|
||||||
def can_remove_post(base_dir: str,
|
def can_remove_post(base_dir: str,
|
||||||
|
@ -1395,7 +1397,8 @@ def _remove_tags_for_nickname(base_dir: str, nickname: str,
|
||||||
if match_str not in tagline:
|
if match_str not in tagline:
|
||||||
tag_file.write(tagline)
|
tag_file.write(tagline)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + tag_filename)
|
print('EX: _remove_tags_for_nickname unable to write ' +
|
||||||
|
tag_filename)
|
||||||
|
|
||||||
|
|
||||||
def remove_account(base_dir: str, nickname: str,
|
def remove_account(base_dir: str, nickname: str,
|
||||||
|
@ -1565,7 +1568,8 @@ def is_person_snoozed(base_dir: str, nickname: str, domain: str,
|
||||||
encoding='utf-8') as snoozfile:
|
encoding='utf-8') as snoozfile:
|
||||||
snoozfile.write(content)
|
snoozfile.write(content)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to write ' + snoozed_filename)
|
print('EX: is_person_snoozed unable to write ' +
|
||||||
|
snoozed_filename)
|
||||||
|
|
||||||
if text_in_file(snooze_actor + ' ', snoozed_filename):
|
if text_in_file(snooze_actor + ' ', snoozed_filename):
|
||||||
return True
|
return True
|
||||||
|
@ -1589,7 +1593,7 @@ def person_snooze(base_dir: str, nickname: str, domain: str,
|
||||||
snoozed_file.write(snooze_actor + ' ' +
|
snoozed_file.write(snooze_actor + ' ' +
|
||||||
str(int(time.time())) + '\n')
|
str(int(time.time())) + '\n')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to append ' + snoozed_filename)
|
print('EX: person_snooze unable to append ' + snoozed_filename)
|
||||||
|
|
||||||
|
|
||||||
def person_unsnooze(base_dir: str, nickname: str, domain: str,
|
def person_unsnooze(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
Loading…
Reference in New Issue