@view_config(route_name='<STR_LIT>',<EOL>permission='<STR_LIT>',<EOL>request_method='<STR_LIT:POST>', accept='<STR_LIT:application/json>', http_cache=<NUM_LIT:0>)<EOL>def post_roles_request(request):
uuid_ = request.matchdict['<STR_LIT>']<EOL>posted_roles = request.json<EOL>with db_connect() as db_conn:<EOL><INDENT>with db_conn.cursor() as cursor:<EOL><INDENT>cursor.execute("""<STR_LIT>""", (uuid_,))<EOL>try:<EOL><INDENT>cursor.fetchone()[<NUM_LIT:0>]<EOL><DEDENT>except TypeError:<EOL><INDENT>if request.has_permission('<STR_LIT>'):<EOL><INDENT>cursor.execute("""<STR_LIT>""", (uuid_,))<EOL><DEDENT>else:<EOL><INDENT>raise httpexceptions.HTTPNotFound()<EOL><DEDENT><DEDENT>try:<EOL><INDENT>upsert_users(cursor, [r['<STR_LIT>'] for r in posted_roles])<EOL><DEDENT>except UserFetchError as exc:<EOL><INDENT>raise httpexceptions.HTTPBadRequest(exc.message)<EOL><DEDENT>upsert_role_requests(cursor, uuid_, posted_roles)<EOL><DEDENT><DEDENT>resp = request.response<EOL>resp.status_int = <NUM_LIT><EOL>return resp<EOL>
Submission to create a role acceptance request.