* luci/libs/uvl: fix option dependency error handling in case of different non-critical reasons

This commit is contained in:
Jo-Philipp Wich 2008-11-04 16:11:25 +00:00
parent 7aee80de5c
commit d1796b2991
2 changed files with 6 additions and 6 deletions

View file

@ -295,9 +295,7 @@ function UVL._validate_option( self, option, nodeps )
if not nodeps then if not nodeps then
local ok, err = dependencies.check( self, option ) local ok, err = dependencies.check( self, option )
if not ok then if not ok then
if not err:is_all(ERR.ERR_DEP_NOTEQUAL) and if not err:is_all(ERR.ERR_DEP_NOTEQUAL,ERR.ERR_DEP_NOVALUE) then
not err:is_all(ERR.ERR_DEP_NOVALUE)
then
option:error(err) option:error(err)
return false, option:errors() return false, option:errors()
else else

View file

@ -185,13 +185,15 @@ function error.is(self, code)
return false return false
end end
function error.is_all(self, code) function error.is_all(self, ...)
if self.code == code then local codes = { ... }
if util.contains(codes, self.code) then
return true return true
else else
local equal = false local equal = false
for _, c in ipairs(self.childs) do for _, c in ipairs(self.childs) do
equal = ( c.code == code ) equal = util.contains(codes, c.code)
end end
return equal return equal
end end