def post_unlink(): n = 0 person_id = request.form.get('person_id') if person_id: n += ps.unlink_discord(person_id) discord_id = request.form.get('discord_id') if discord_id: n += ps.remove_discord_link(discord_id) return unlink(n)
def post_unlink() -> str: n, errors = 0, [] person_id = request.form.get('person_id') if person_id: n += ps.unlink_discord(person_id) discord_id = request.form.get('discord_id') if discord_id: try: discord_id = int(discord_id) n += ps.remove_discord_link(discord_id) except ValueError: errors.append('Discord ID must be an integer.') return unlink(n, errors)