Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Make take_over idempotent (fixes #617).
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynekwinkler committed Jan 13, 2014
1 parent 5f2b0b0 commit 981bd90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
24 changes: 1 addition & 23 deletions gittip/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,7 @@ def _check_orphans(self):
where not exists (select * from elsewhere where elsewhere.participant=username)
and not exists (select * from absorptions where archived_as=username)
""")
known = set((
"4c46cc22afdd",
"82b0d81fe9e8",
"6b6527ac6c02",
"cbde8c31c11c",
"bcfc65158eaf",
"31d54a0c19ae",
"afbddadaac3c",
"a78c4e42bb93",
"42eb93b3ab89",
"b1bc5e47fe8e",
"3ac515cc8da6",
"14a79340c40d",
"14d60c6884e7",
"0c783dee50ed",
"e2020536ef6d",
"60a5099d49c7",
"64f4f959b322",
"0bdf90d51786",
"880ac6873f7f"
))
real = set(orphans) - known
assert len(real) == 0, "missing elsewheres: {}".format(list(real))
assert len(orphans) == 0, "missing elsewheres: {}".format(list(orphans))

def _check_orphans_no_tips(self):
"""
Expand Down
4 changes: 4 additions & 0 deletions gittip/models/_mixin_elsewhere.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ def take_over(self, account_elsewhere, have_confirmation=False):

other_username = rec.participant

if self.username == other_username:
# this is a no op - trying to take over itself
return


# Make sure we have user confirmation if needed.
# ==============================================
Expand Down

0 comments on commit 981bd90

Please sign in to comment.