def session_chain_add(session_name, table_name, chain_name):
try:
req = request.get_json()
if req is None:
req = {}
fw.sessions[session_name].chains.add(
name=chain_name, table=table_name, **req)
return make_response(jsonify(message='Chain created'), status.HTTP_201_CREATED)
except ChainExists as e:
http_code = status.HTTP_409_CONFLICT
except ChainNotValid as e:
http_code = status.HTTP_400_BAD_REQUEST
except Exception as e:
http_code = status.HTTP_500_INTERNAL_SERVER_ERROR
return make_response(jsonify(message='Failed to create chain', error=e.message), http_code)
评论列表
文章目录