def update_lot(lot_id): if not Lot.can_user_edit(user.email(), lot_id): raise NoPermissionError() if not request.json: raise NoJsonError() data_available = [ "name", "amount", "currency", "term", "return_way", "security", "percentage", "form", "commentary", ] for data in data_available: if data in request.json: Lot.update_data(lot_id, data, request.json[data]) return RestAPI.message("A lot is changed"), 201
def update_lot(lot_id): if not Lot.can_user_edit(user.email(), lot_id): raise NoPermissionError() if not request.json: raise NoJsonError() data_available = [ 'name', 'amount', 'currency', 'term', 'return_way', 'security', 'percentage', 'form', 'commentary' ] for data in data_available: if data in request.json: Lot.update_data(lot_id, data, request.json[data]) return RestAPI.message('A lot is changed'), 201