Module: check_mk
Branch: master
Commit: b036893636d90d24e49aaa0d3fadc1b25a847cc9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b036893636d90d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Mar 10 17:29:36 2013 +0100
htmllib: new function del_all_vars()
---
web/htdocs/forms.py | 2 +-
web/htdocs/htmllib.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/forms.py b/web/htdocs/forms.py
index a519e7f..1cee46a 100644
--- a/web/htdocs/forms.py
+++ b/web/htdocs/forms.py
@@ -54,7 +54,7 @@ def edit_dictionary(entries, value, focus=None, hover_help=True,
validate=None,
messages.append(u"%s: %s" % (vs.title(), e.message))
html.add_user_error(e.varname, e.message)
- if validate:
+ if validate and not html.has_user_errors():
try:
validate(new_value)
except MKUserError, e:
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 2128ad4..dc8f8d8 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -1041,6 +1041,10 @@ class html:
if varname in self.req.listvars:
del self.req.listvars[varname]
+ def del_all_vars(self):
+ self.req.vars = {}
+ self.req.listvars = {}
+
def javascript(self, code):
self.write("<script
language=\"javascript\">\n%s\n</script>\n" % code)