Module: check_mk
Branch: master
Commit: 561f8fadef71e4900c8dbe2bbe01e919d191ade8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=561f8fadef71e4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 21 10:07:39 2017 +0100
Improved error handling when accessing not existing werks
Change-Id: Ibd52d00da65fea2f75db7c6acfae2849009563e2
---
web/htdocs/werks.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/web/htdocs/werks.py b/web/htdocs/werks.py
index 9a1c044..0e4675d 100644
--- a/web/htdocs/werks.py
+++ b/web/htdocs/werks.py
@@ -53,7 +53,10 @@ def page_version():
def handle_acknowledgement():
if html.var("_werk_ack") and html.check_transaction():
werk_id = html.get_integer_input("_werk_ack")
+ if werk_id not in g_werks:
+ raise MKUserError("werk", _("This werk does not
exist."))
werk = g_werks[werk_id]
+
if werk["compatible"] == "incomp_unack":
acknowledge_werk(werk)
html.message(HTML(_("Werk %s - %s has been acknowledged.") %
(render_werk_id(werk, with_link=True), render_werk_title(werk))))
@@ -74,6 +77,8 @@ def handle_acknowledgement():
def page_werk():
load_werks()
werk_id = html.get_integer_input("werk")
+ if werk_id not in g_werks:
+ raise MKUserError("werk", _("This werk does not exist."))
werk = g_werks[werk_id]
html.header(("%s %s - %s") % (_("Werk"), render_werk_id(werk,
with_link=False), werk["title"]), stylesheets = werks_stylesheets)