def handle_delete_annotations(): if html.request.var("_delete_annotation"): _site_id, _hostname, _service, host_state, service_state, fromtime, \ untiltime, site_host_svc = _handle_anno_request_vars() annotations = availability.load_annotations() annotation = availability.find_annotation(annotations, site_host_svc, host_state, service_state, fromtime, untiltime) if not annotation: return if not html.confirm( _("Are you sure that you want to delete the annotation '%s'?") % annotation["text"]): return availability.delete_annotation(annotations, site_host_svc, host_state, service_state, fromtime, untiltime) availability.save_annotations(annotations)
def handle_delete_annotations(): if html.request.var("_delete_annotation"): site_id = html.request.var("anno_site") or "" hostname = html.request.var("anno_host") service = html.request.var("anno_service") or None fromtime = float(html.request.var("anno_from")) untiltime = float(html.request.var("anno_until")) site_host_svc = (site_id, hostname, service) annotations = availability.load_annotations() annotation = availability.find_annotation(annotations, site_host_svc, fromtime, untiltime) if not annotation: return if not html.confirm( _("Are you sure that you want to delete the annotation '%s'?") % annotation["text"]): return availability.delete_annotation(annotations, site_host_svc, fromtime, untiltime) availability.save_annotations(annotations)