* luci-0.8: merge r3710
This commit is contained in:
parent
2f4957fc3c
commit
cfdfa4ea1a
2 changed files with 20 additions and 6 deletions
|
@ -295,7 +295,11 @@ 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,ERR.ERR_DEP_NOVALUE) then
|
if not err:is_all(
|
||||||
|
ERR.ERR_OPT_REQUIRED,
|
||||||
|
ERR.ERR_DEP_NOTEQUAL,
|
||||||
|
ERR.ERR_DEP_NOVALUE
|
||||||
|
) then
|
||||||
option:error(err)
|
option:error(err)
|
||||||
return false, option:errors()
|
return false, option:errors()
|
||||||
else
|
else
|
||||||
|
@ -361,16 +365,22 @@ function UVL._validate_option( self, option, nodeps )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
v = tonumber(v)
|
local w = tonumber(v)
|
||||||
|
|
||||||
if option:scheme('minimum') then
|
if option:scheme('minimum') then
|
||||||
if not v or v < option:scheme('minimum') then
|
if not w or w < option:scheme('minimum') then
|
||||||
return false, option:error(ERR.OPT_RANGE(option))
|
return false, option:error(ERR.OPT_RANGE(option))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if option:scheme('maximum') then
|
if option:scheme('maximum') then
|
||||||
if not v or v > option:scheme('maximum') then
|
if not w or w > option:scheme('maximum') then
|
||||||
|
return false, option:error(ERR.OPT_RANGE(option))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if option:scheme('max_nil') then
|
||||||
|
if v and (not w or w > tonumber(option:scheme('max_nil'))) then
|
||||||
return false, option:error(ERR.OPT_RANGE(option))
|
return false, option:error(ERR.OPT_RANGE(option))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -193,8 +193,12 @@ function error.is_all(self, ...)
|
||||||
else
|
else
|
||||||
local equal = false
|
local equal = false
|
||||||
for _, c in ipairs(self.childs) do
|
for _, c in ipairs(self.childs) do
|
||||||
|
if c.childs then
|
||||||
|
equal = c:is_all(...)
|
||||||
|
else
|
||||||
equal = util.contains(codes, c.code)
|
equal = util.contains(codes, c.code)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return equal
|
return equal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue