Revert "Replace appends with functions"

This reverts commit 9a30659731.
main
bashrc 2026-04-26 17:09:34 +01:00
parent bccb1d658e
commit e5166d9636
1 changed files with 18 additions and 14 deletions

View File

@ -1740,20 +1740,24 @@ def import_blocking_file(base_dir: str, nickname: str, domain: str,
if not append_blocks: if not append_blocks:
return True return True
text = '' try:
for new_block in append_blocks: with open(blocking_filename, 'a+', encoding='utf-8') as fp_blocks:
text += new_block + '\n' for new_block in append_blocks:
append_string(text, blocking_filename, fp_blocks.write(new_block + '\n')
'EX: ' + except OSError:
'unable to append imported blocks to ' + print('EX: ' +
blocking_filename) 'unable to append imported blocks to ' +
text = '' blocking_filename)
for new_reason in append_reasons:
text += new_reason + '\n' try:
append_string(text, blocking_reasons_filename, with open(blocking_reasons_filename, 'a+',
'EX: ' + encoding='utf-8') as fp_blocks:
'unable to append imported block reasons to ' + for new_reason in append_reasons:
blocking_reasons_filename) fp_blocks.write(new_reason + '\n')
except OSError:
print('EX: ' +
'unable to append imported block reasons to ' +
blocking_reasons_filename)
return True return True