Module: check_mk
Branch: master
Commit: d50b37f432d7d92bbca55176911096daa81cbe6f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d50b37f432d7d9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 18 16:46:38 2012 +0200
FIX: complex list widgets (ListOf) lost remaining entries after deleting one
---
ChangeLog | 1 +
web/htdocs/valuespec.py | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c07d28c..d853353 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -94,6 +94,7 @@
* FIX: Remove also user settings and event console rule on factory reset
* FIX: complex list widgets (ListOf) failed back to old value when
complaining
+ * FIX: complex list widgets (ListOf) lost remaining entries after deleting one
BI:
* Great speed up of rule compilation in large environments
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 3457868..650f3ee 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -665,13 +665,13 @@ class ListOf(ValueSpec):
return s + '</table>'
def from_html_vars(self, varprefix):
+ count = int(html.var(varprefix + "_count"))
n = 1
indexes = {}
- while True:
+ while n <= count:
indexof = html.var(varprefix + "_indexof_%d" % n)
- if indexof == None:
- break
- indexes[int(indexof)] = n
+ if indexof != None: # deleted entry
+ indexes[int(indexof)] = n
n += 1
value = []