Skip to content

Commit

Permalink
Change blacklisting to prevent extra newlines
Browse files Browse the repository at this point in the history
Not that it was a big deal anyway, but this'll fix it.
  • Loading branch information
csnardi committed Oct 27, 2016
1 parent 974e882 commit 48dd6a9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gitmanager.py
Expand Up @@ -26,9 +26,11 @@ def add_to_blacklist(self, items_to_blacklist, username, code_permissions):
current_commit = git("rev-parse", "HEAD").strip()

# Add items to file

with open("blacklisted_websites.txt", "a") as blacklisted_websites:
blacklisted_websites.write("\n" + "\n".join(items_to_blacklist))
with open("blacklisted_websites.txt", "a+") as blacklisted_websites:
last_character = blacklisted_websites.read()[-1:]
if last_character != "\n":
blacklisted_websites.write("\n")
blacklisted_websites.write("\n".join(items_to_blacklist) + "\n")

# Checkout a new branch (mostly unnecessary, but may help if we create PRs in the future
branch = "auto-blacklist-{0}".format(str(time.time()))
Expand Down

0 comments on commit 48dd6a9

Please sign in to comment.