def handle_valid_members_form(request, project_id, addmembers_form): if addmembers_form.is_valid(): try: users = addmembers_form.valid_users for user in users: functions.enroll_member_by_email(project_id, user.email, request_user=request.user) except functions.ProjectError as e: messages.error(request, e)
def enroll_user(data, request_user): project_id = data.get("project") email = data.get("user") with ExceptionHandler(): m = functions.enroll_member_by_email(project_id, email, request_user) response = {"id": m.id} return json_response(response)
def enroll_user(data, request_user): project_id = data.get("project") email = data.get("user") with ExceptionHandler(): m = functions.enroll_member_by_email( project_id, email, request_user) response = {"id": m.id} return json_response(response)
def enroll_user(data, request_user): project_id = data.get("project") if not isinstance(project_id, (basestring, int)): raise faults.BadRequest("Invalid project ID: %s" % project_id) email = data.get("user") with ExceptionHandler(): m = functions.enroll_member_by_email(project_id, email, request_user) response = {"id": m.id} return json_response(response)