libs/cbi: Simplified _uvl_validate_section
authorSteven Barth <steven@midlink.org>
Sat, 30 Aug 2008 15:41:02 +0000 (15:41 +0000)
committerSteven Barth <steven@midlink.org>
Sat, 30 Aug 2008 15:41:02 +0000 (15:41 +0000)
libs/cbi/luasrc/cbi.lua

index 6ffeca6b0af507c6f005d345b3426cbe593f6df8..fe207739f67bd3d843b5dc52aeacd748e0ed94a0 100644 (file)
@@ -94,16 +94,13 @@ local function _uvl_validate_section(node, name)
                end
                for i, v in ipairs(err.childs) do
                        if v.option and node.fields[v.option] then
-                               if v:is(luci.uvl.errors.ERR_OPTION) then
-                                       local suberr = v.childs and v.childs[1]
-                                       if suberr:is(luci.uvl.errors.ERR_DEPENDENCY) then
-                                               node.fields[v.option].tag_reqerror[name] = true
-                                       elseif suberr:is(luci.uvl.errors.ERR_OPT_REQUIRED) then
-                                               node.fields[v.option].tag_missing[name] = true
-                                               node.tag_deperror[name] = true
-                                       else
-                                               node.fields[v.option].tag_invalid[name] = true
-                                       end
+                               if v:is(luci.uvl.errors.ERR_DEPENDENCY) then
+                                       node.fields[v.option].tag_reqerror[name] = true
+                               elseif v:is(luci.uvl.errors.ERR_OPT_REQUIRED) then
+                                       node.fields[v.option].tag_missing[name] = true
+                                       node.tag_deperror[name] = true
+                               elseif v:is(luci.uvl.errors.ERR_OPTION) then
+                                       node.fields[v.option].tag_invalid[name] = true
                                end
                        end
                end