Example #1
0
def delete(params):
    """Delete a time period"""
    name = params['name']
    time_periods = load_timeperiods()
    if name not in time_periods:
        raise ProblemException(404, http.client.responses[404], f"Time period {name} not found")
    del time_periods[name]
    save_timeperiods(time_periods)
    return Response(status=204)
Example #2
0
def delete(params):
    """Delete a time period"""
    user.need_permission("wato.edit")
    user.need_permission("wato.timeperiods")
    name = params["name"]
    time_periods = load_timeperiods()
    if name not in time_periods:
        raise ProblemException(404, http.client.responses[404],
                               f"Time period {name} not found")
    del time_periods[name]
    save_timeperiods(time_periods)
    return Response(status=204)