Esempio n. 1
0
def perform_get_list(lid):
    """
    """
    lst = data.get_list(lid)

    if not lst:
        return json.dumps(_create_error("", "list not found", "Cannot find list with ID %s" % lid)), 404

    return json.dumps([lst]), 200
Esempio n. 2
0
def perform_delete_list(lid):
    """
    """
    lst = data.get_list(lid)

    if not lst:
        return json.dumps(_create_error("", "list not found", "Cannot find list with ID %s" % lid)), 404

    data.delete_list(lst)

    return "", 204
Esempio n. 3
0
def perform_update_list(lid, d):
    """
    """
    lst = data.get_list(lid)

    if not lst:
        return json.dumps(_create_error("", "list not found", "Cannot find list with ID %s" % lid)), 404

    if data.list_equals(lst, d):
        return json.dumps(_create_error("", "No changes to modify the entity", "There are no attribute changes to modify the entity.")), 409

    lst.update(d)

    error = _validate_list(lst)
    if error:
        return json.dumps(error), 409

    return json.dumps([lst]), 200