Module: check_mk
Branch: master
Commit: 2ac399f95bf19ee0d8e6849b1f261c23d7ce2302
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ac399f95bf19e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Oct 3 00:02:21 2014 +0200
Fix exception on validation error in CascadingDropdown
---
web/htdocs/valuespec.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index aec4ea4..dbdde99 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1254,7 +1254,7 @@ class CascadingDropdown(ValueSpec):
# make sure, that the visibility is done correctly, in both
# cases:
- # 1. Form painted for the first time (no submission yet, vp missing in URL
+ # 1. Form painted for the first time (no submission yet, vp missing in URL)
# 2. Form already submitted -> honor URL variable vp for visibility
cur_val = html.var(vp)
@@ -1264,7 +1264,10 @@ class CascadingDropdown(ValueSpec):
vp = varprefix + "_%d" % nr
# Form already submitted once (and probably in complain state)
if cur_val != None:
- def_val_2 = vs.from_html_vars(vp)
+ try:
+ def_val_2 = vs.from_html_vars(vp)
+ except MKUserError:
+ def_val_2 = vs.default_value()
if cur_val == str(nr):
disp = ""
else: