Module: check_mk
Branch: master
Commit: 6afe6b02254ecdca06a963cc58d2d514242a681c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6afe6b02254ecd…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Apr 9 09:24:32 2018 +0200
Remove unused imports from web/htdocs/notifications.py
Change-Id: Icc3ea041ff96d281031e9434e1840f5426a6cfd8
---
web/htdocs/notifications.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/notifications.py b/web/htdocs/notifications.py
index f9c86df..efd47c6 100644
--- a/web/htdocs/notifications.py
+++ b/web/htdocs/notifications.py
@@ -26,13 +26,10 @@
import config
import lib
-import errno
-import os
import sites
import table
import time
import wato
-import watolib
g_acknowledgement_time = {}
g_modified_time = 0
@@ -66,20 +63,24 @@ def acknowledge_failed_notifications(timestamp):
g_acknowledgement_time[config.user.id] = timestamp
save_acknowledgements()
+
def set_modified_time():
global g_modified_time
g_modified_time = time.time()
+
def save_acknowledgements():
config.user.save_file("acknowledged_notifications",
int(g_acknowledgement_time[config.user.id]))
set_modified_time()
+
def acknowledged_time():
if g_acknowledgement_time.get(config.user.id) is None or\
config.user.file_modified("acknowledged_notifications") >
g_modified_time:
load_acknowledgements()
return g_acknowledgement_time[config.user.id]
+
def load_acknowledgements():
g_acknowledgement_time[config.user.id] =
config.user.load_file("acknowledged_notifications", 0)
set_modified_time()
@@ -89,6 +90,7 @@ def load_acknowledgements():
# when retrieving the list
acknowledge_failed_notifications(time.time())
+
def load_failed_notifications(before=None, after=None, stat_only=False,
extra_headers=None):
may_see_notifications =\
config.user.may("general.see_failed_notifications") or\
@@ -143,6 +145,7 @@ def load_failed_notifications(before=None, after=None,
stat_only=False, extra_he
else:
return sites.live().query(query)
+
def render_notification_table(failed_notifications):
table.begin()
@@ -159,6 +162,7 @@ def render_notification_table(failed_notifications):
table.end()
+
# TODO: We should really recode this to use the view and a normal view command / action
def render_page_confirm(acktime, prev_url, failed_notifications):
html.header(_("Confirm failed notifications"), javascripts=[],
stylesheets=[ "pages", "check_mk" ])
@@ -177,6 +181,7 @@ def render_page_confirm(acktime, prev_url, failed_notifications):
html.footer()
+
def page_clear():
acktime = html.var('acktime')
if acktime is None:
@@ -196,4 +201,3 @@ def page_clear():
failed_notifications = load_failed_notifications(before=acktime,
after=acknowledged_time())
render_page_confirm(acktime, prev_url, failed_notifications)
-