[checkmk-commits] Check_MK Git: check_mk: icon selector accepts internal icons during value validation

Lars Michelsen lm at mathias-kettner.de
Mon Apr 20 11:48:12 CEST 2015


Module: check_mk
Branch: master
Commit: 35e7e850be7a37c9afcdd8c4e0fbd01f98bdf91b
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35e7e850be7a37c9afcdd8c4e0fbd01f98bdf91b

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Mon Apr 20 11:44:45 2015 +0200

icon selector accepts internal icons during value validation

---

 web/htdocs/valuespec.py |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index bb3423c..96259e1 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -3367,7 +3367,14 @@ class IconSelector(ValueSpec):
         if not self._allow_empty and not value:
             raise MKUserError(varprefix, _("You need to select an icon."))
 
-        if value and value not in self.available_icons():
+        def is_internal_icon():
+            if defaults.omd_root:
+                base_path = defaults.omd_root+"/share/check_mk/web/htdocs/images"
+            else:
+                base_path = defaults.web_dir+"/htdocs/images"
+            return os.path.exists(base_path+'/icon_'+value+'.png')
+
+        if value and value not in self.available_icons() and not is_internal_icon():
             raise MKUserError(varprefix, _("The selected icon image does not exist."))
 
 



More information about the checkmk-commits mailing list