def update(slug): """ Update the data of the network. """ network = _get_network(slug) require.network.update(network) data = request_content(request) context = ValidationContext(network=network) data = validate_network(dict(data.items()), context) network.update(data) db.session.commit() return jsonify(network)
def create(): """ Create a new network. """ require.network.create() data = request_content(request) context = ValidationContext() data = validate_network(dict(data.items()), context) network = Network.create(data) db.session.commit() url = url_for(".get", slug=network.slug) return jsonify(network, status=201, headers={"location": url})
def update(slug): """ Update the data of the network. """ network = _get_network(slug) require.network.update(network) data = request_content(request) context = ValidationContext(network=network) data = validate_network(dict(data.items()), \ context) network.update(data) db.session.commit() return jsonify(network)
def create(): """ Create a new network. """ require.network.create() data = request_content(request) context = ValidationContext() data = validate_network(dict(data.items()), \ context) network = Network.create(data) db.session.commit() url = url_for('.get', slug=network.slug) return jsonify(network, status=201, headers={'location': url})