Wrong file

main
Bob Mottram 2020-11-06 18:56:53 +00:00
parent 8ca64dd736
commit 1f023214ab
1 changed files with 6 additions and 5 deletions

View File

@ -205,10 +205,11 @@ def unfollowPerson(baseDir: str, nickname: str, domain: str,
return return
with open(filename, "r") as f: with open(filename, "r") as f:
lines = f.readlines() lines = f.readlines()
with open(filename, 'w+') as f: with open(filename, 'w+') as f:
for line in lines: for line in lines:
if line.strip("\n").strip("\r").lower() != handleToUnfollowLower: if line.strip("\n").strip("\r").lower() != \
f.write(line) handleToUnfollowLower:
f.write(line)
# 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
@ -216,7 +217,7 @@ def unfollowPerson(baseDir: str, nickname: str, domain: str,
if os.path.isfile(unfollowedFilename): if os.path.isfile(unfollowedFilename):
if handleToUnfollowLower not in \ if handleToUnfollowLower not in \
open(unfollowedFilename).read().lower(): open(unfollowedFilename).read().lower():
with open(filename, "a+") as f: with open(unfollowedFilename, "a+") as f:
f.write(handleToUnfollow + '\n') f.write(handleToUnfollow + '\n')
else: else:
with open(unfollowedFilename, "w+") as f: with open(unfollowedFilename, "w+") as f: