@blueprint.route('<STR_LIT>',<EOL>methods=['<STR_LIT:POST>'])<EOL>@login_required<EOL>def approve(group_id, user_id):
membership = Membership.query.get_or_404((user_id, group_id))<EOL>group = membership.group<EOL>if group.can_edit(current_user):<EOL><INDENT>try:<EOL><INDENT>membership.accept()<EOL><DEDENT>except Exception as e:<EOL><INDENT>flash(str(e), '<STR_LIT:error>')<EOL>return redirect(url_for('<STR_LIT>', group_id=membership.group.id))<EOL><DEDENT>flash(_('<STR_LIT>',<EOL>user=membership.user.email,<EOL>name=membership.group.name), '<STR_LIT:success>')<EOL>return redirect(url_for('<STR_LIT>', group_id=membership.group.id))<EOL><DEDENT>flash(<EOL>_(<EOL>'<STR_LIT>',<EOL>group_name=group.name<EOL>),<EOL>'<STR_LIT:error>'<EOL>)<EOL>return redirect(url_for('<STR_LIT>'))<EOL>
Approve a user.