Consistent append

merge-requests/8/head
Bob Mottram 2020-08-20 12:34:39 +01:00
parent 7a0914253e
commit 28830ed660
3 changed files with 3 additions and 3 deletions

View File

@ -130,7 +130,7 @@ def storeBasicCredentials(baseDir: str, nickname: str, password: str) -> bool:
os.rename(passwordFile + '.new', passwordFile)
else:
# append to password file
with open(passwordFile, "a") as passfile:
with open(passwordFile, 'a+') as passfile:
passfile.write(storeStr + '\n')
else:
with open(passwordFile, "w") as passfile:

View File

@ -520,7 +520,7 @@ def storeFollowRequest(baseDir: str,
approveFollowsFilename = accountsDir + '/followrequests.txt'
if os.path.isfile(approveFollowsFilename):
if approveHandle not in open(approveFollowsFilename).read():
with open(approveFollowsFilename, "a") as fp:
with open(approveFollowsFilename, 'a+') as fp:
fp.write(approveHandle + '\n')
else:
if debug:

View File

@ -1581,7 +1581,7 @@ def populateReplies(baseDir: str, httpPrefix: str, domain: str,
if numLines > maxReplies:
return False
if messageId not in open(postRepliesFilename).read():
repliesFile = open(postRepliesFilename, "a")
repliesFile = open(postRepliesFilename, 'a+')
repliesFile.write(messageId + '\n')
repliesFile.close()
else: