mirror of https://gitlab.com/bashrc2/epicyon
Exception handling
parent
724ffb7dff
commit
9cc8a2fb00
17
posts.py
17
posts.py
|
|
@ -5829,15 +5829,26 @@ def archive_posts_for_person(http_prefix: str, nickname: str, domain: str,
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
ext_path = file_path.replace('.json', '.' + ext)
|
ext_path = file_path.replace('.json', '.' + ext)
|
||||||
if os.path.isfile(ext_path):
|
if os.path.isfile(ext_path):
|
||||||
|
try:
|
||||||
os.rename(ext_path,
|
os.rename(ext_path,
|
||||||
archive_path.replace('.json', '.' + ext))
|
archive_path.replace('.json', '.' + ext))
|
||||||
else:
|
except OSError:
|
||||||
ext_path = file_path.replace('.json',
|
print('EX: unable to archive file ' + ext_path +
|
||||||
'.json.' + ext)
|
' -> ' +
|
||||||
|
archive_path.replace('.json', '.' + ext))
|
||||||
|
continue
|
||||||
|
ext_path = file_path.replace('.json', '.json.' + ext)
|
||||||
if os.path.isfile(ext_path):
|
if os.path.isfile(ext_path):
|
||||||
|
try:
|
||||||
os.rename(ext_path,
|
os.rename(ext_path,
|
||||||
archive_path.replace('.json',
|
archive_path.replace('.json',
|
||||||
'.json.' + ext))
|
'.json.' + ext))
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to archive file ' + ext_path +
|
||||||
|
' -> ' +
|
||||||
|
archive_path.replace('.json',
|
||||||
|
'.json.' + ext))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
delete_post(base_dir, http_prefix, nickname, domain,
|
delete_post(base_dir, http_prefix, nickname, domain,
|
||||||
file_path, False, recent_posts_cache, False)
|
file_path, False, recent_posts_cache, False)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue