libs/cbi: Temporarily allow invalid configuration values to be saved
[project/luci.git] / libs / cbi / luasrc / cbi.lua
index 543c895af4e3c3daf4c5f07e0b05e0e457e130df..7dabe2d6002a9fc84105c1fca7fad037787e66dc 100644 (file)
@@ -629,7 +629,7 @@ function NamedSection.parse(self)
                                local co = self.map:get()
                                local stat, err = self.map.validator:validate_section(self.config, s, co)
                                if err then
-                                       self.map.save = false
+                                       --self.map.save = false
                                        if err.code == luci.uvl.errors.ERR_DEPENDENCY then
                                                self.tag_deperror[s] = true
                                        else
@@ -745,7 +745,7 @@ function TypedSection.parse(self)
                                local co = self.map:get()
                                local stat, err = self.map.validator:validate_section(self.config, k, co)
                                if err then
-                                       self.map.save = false
+                                       --self.map.save = false
                                        if err.code == luci.uvl.errors.ERR_DEPENDENCY then
                                                self.tag_deperror[k] = true
                                        else
@@ -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))