We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The need for this arose in #1098.
The text was updated successfully, but these errors were encountered:
This is what I used:
def transform_into_team(self, first_member): old_kind = self.kind assert old_kind in ('individual', 'organization') assert self.balance == 0 assert self.status == 'active' assert first_member.kind in ('individual', 'organization') assert first_member.status == 'active' mp_account = self.get_mangopay_account() with self.db.get_cursor() as cursor: r = cursor.one(""" UPDATE participants SET kind = 'group' , mangopay_user_id = NULL WHERE id = %s AND kind = %s RETURNING kind, mangopay_user_id """, (self.id, self.kind)) if not r: raise response.error(409, "race condition") self.set_attributes(**r._asdict()) if mp_account: self.add_event(cursor, 'mangopay-account-change', { 'old_user_id': mp_account.Id, 'old_user_type': mp_account.PersonType, }) self.add_event(cursor, 'account-kind-change', { 'old_kind': old_kind, 'new_kind': 'group', }) self.add_member(first_member, cursor=cursor) # Drop sessions and passwords self.db.run("DELETE FROM user_secrets WHERE participant = %s", (self.id,)) # Invalidate exchange routes routes = self.db.all(""" SELECT r FROM exchange_routes r WHERE participant = %s AND error <> 'invalidated' """, (self.id,)) for route in routes: route.invalidate()
Sorry, something went wrong.
No branches or pull requests
The need for this arose in #1098.
The text was updated successfully, but these errors were encountered: