mirror of https://gitlab.com/bashrc2/epicyon
Replace file operations with function
parent
5a4ff22aed
commit
721907ca4d
14
question.py
14
question.py
|
|
@ -160,14 +160,12 @@ def question_update_votes(base_dir: str, nickname: str, domain: str,
|
||||||
else:
|
else:
|
||||||
newlines.append(vote_line)
|
newlines.append(vote_line)
|
||||||
if save_voters_file:
|
if save_voters_file:
|
||||||
try:
|
text = ''
|
||||||
with open(voters_filename, 'w+',
|
for vote_line in newlines:
|
||||||
encoding='utf-8') as fp_voters:
|
text += vote_line
|
||||||
for vote_line in newlines:
|
save_string(text, voters_filename,
|
||||||
fp_voters.write(vote_line)
|
'EX: unable to write voters file2 ' +
|
||||||
except OSError:
|
voters_filename)
|
||||||
print('EX: unable to write voters file2 ' +
|
|
||||||
voters_filename)
|
|
||||||
else:
|
else:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue