Module: check_mk
Branch: master
Commit: 84711d3475341b486d6206cb6d2d7317a3981946
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=84711d3475341b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 7 17:58:28 2012 +0100
New ValueSpecAttribute: generic host attribute
---
web/htdocs/wato.py | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 8f47972..ebba72c 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3791,6 +3791,36 @@ class HostTagAttribute(Attribute):
return [] # No matching tag
+# An attribute using the generic ValueSpec mechanism
+class ValueSpecAttribute(Attribute):
+ def __init__(self, name, vs):
+ Attribute.__init__(self, name)
+ self._valuespec = vs
+
+ def title(self):
+ return self._valuespec.title()
+
+ def help(self):
+ return self._valuespec.help()
+
+ def default_value(self):
+ return self._valuespec.default_value()
+
+ def paint(self, value, hostname):
+ return "", \
+ self._valuespec.value_to_text(value)
+
+ def render_input(self, value):
+ self._valuespec.render_input(self._name, value)
+
+ def from_html_vars(self):
+ return self._valuespec.from_html_vars(self._name)
+
+ def validate_input(self):
+ value = self.from_html_vars()
+ self._valuespec.validate_value(value, self._name)
+
+
# Attribute needed for folder permissions
class ContactGroupsAttribute(Attribute):
# The constructor stores name and title. If those are