* luci/libs/uvl: fix option dependency error handling in case of different non-critic...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 4 Nov 2008 16:11:25 +0000 (16:11 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 4 Nov 2008 16:11:25 +0000 (16:11 +0000)
libs/uvl/luasrc/uvl.lua
libs/uvl/luasrc/uvl/errors.lua

index 3963a64..3b3186e 100644 (file)
@@ -295,9 +295,7 @@ function UVL._validate_option( self, option, nodeps )
                if not nodeps then
                        local ok, err = dependencies.check( self, option )
                        if not ok then
                if not nodeps then
                        local ok, err = dependencies.check( self, option )
                        if not ok then
-                               if not err:is_all(ERR.ERR_DEP_NOTEQUAL) and
-                                  not err:is_all(ERR.ERR_DEP_NOVALUE)
-                               then
+                               if not err:is_all(ERR.ERR_DEP_NOTEQUAL,ERR.ERR_DEP_NOVALUE) then
                                        option:error(err)
                                        return false, option:errors()
                                else
                                        option:error(err)
                                        return false, option:errors()
                                else
index 983b619..a575f40 100644 (file)
@@ -185,13 +185,15 @@ function error.is(self, code)
        return false
 end
 
        return false
 end
 
-function error.is_all(self, code)
-       if self.code == code then
+function error.is_all(self, ...)
+       local codes = { ... }
+
+       if util.contains(codes, self.code) then
                return true
        else
                local equal = false
                for _, c in ipairs(self.childs) do
                return true
        else
                local equal = false
                for _, c in ipairs(self.childs) do
-                       equal = ( c.code == code )
+                       equal = util.contains(codes, c.code)
                end
                return equal
        end
                end
                return equal
        end