Module: check_mk
Branch: master
Commit: 50307c43cf54c5da94b47f7caa2d3305d0351c6f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=50307c43cf54c5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 7 16:38:47 2014 +0200
Avoid exception on Dictionary without elements
---
web/htdocs/valuespec.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 5edd1ad..cd6d6fb 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -2558,10 +2558,12 @@ class Dictionary(ValueSpec):
return value
def _get_elements(self):
- if type(self._elements) == list:
+ if type(self._elements) == type(lambda: None):
+ return self._elements()
+ elif type(self._elements) == list:
return self._elements
else:
- return self._elements()
+ return []
def render_input(self, varprefix, value):
value = self.migrate(value)