diff options
author | Steven Barth <steven@midlink.org> | 2008-08-28 21:30:49 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-28 21:30:49 +0000 |
commit | 8003e3b6482e770483499debdb916d1c08d4d7e5 (patch) | |
tree | c6d9c7222534f5dc61ac06cb0fd46b97a1dc7810 | |
parent | 3dea61aaa3c4c090debf09b2bd5ac2c81a6c6fa3 (diff) |
libs/cbi: Make sure options in ListValues are unique
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 543c895af..2585e5459 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -1065,7 +1065,8 @@ function ListValue.__init__(self, ...) end for k, v in pairs(vs.values) do local deps = {} - if vs.enum_depends and vs.enum_depends[k] then + if not self.override_dependencies + and vs.enum_depends and vs.enum_depends[k] then for i, dep in ipairs(vs.enum_depends[k]) do table.insert(deps, _uvl_strip_remote_dependencies(dep)) end @@ -1077,6 +1078,10 @@ function ListValue.__init__(self, ...) end function ListValue.value(self, key, val, ...) + if luci.util.contains(self.keylist, key) then + return + end + val = val or key table.insert(self.keylist, tostring(key)) table.insert(self.vallist, tostring(val)) @@ -1123,6 +1128,10 @@ function MultiValue.render(self, ...) end function MultiValue.value(self, key, val) + if luci.util.contains(self.keylist, key) then + return + end + val = val or key table.insert(self.keylist, tostring(key)) table.insert(self.vallist, tostring(val)) |