def update_server(server_id): context = flask.request.environ.get('context') values = flask.request.json try: server_schema.validate(values) server = central_api.update_server(context, server_id, values=values) except exceptions.Forbidden: return flask.Response(status=401) except exceptions.InvalidObject, e: return flask.Response(status=400, response=str(e))
def update_server(server_id): context = flask.request.environ.get("context") values = flask.request.json try: server = central_api.get_server(context, server_id) server.update(values) server_schema.validate(server) server = central_api.update_server(context, server_id, values=values) except exceptions.Forbidden: return flask.Response(status=401) except exceptions.InvalidObject, e: response_body = json.dumps({"errors": e.errors}) return flask.Response(status=400, response=response_body)