* luci-0.8: merge r3710
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 4 Nov 2008 23:50:14 +0000 (23:50 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 4 Nov 2008 23:50:14 +0000 (23:50 +0000)
libs/uvl/luasrc/uvl.lua
libs/uvl/luasrc/uvl/errors.lua

index 3b3186eb25758f7f087945a1ddc8cd8ef707d399..b34f66bc186af442ffc3936dae8b6435ad5e0274 100644 (file)
@@ -295,7 +295,11 @@ function UVL._validate_option( self, option, nodeps )
                if not nodeps then
                        local ok, err = dependencies.check( self, option )
                        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)
                                        return false, option:errors()
                                else
@@ -361,16 +365,22 @@ function UVL._validate_option( self, option, nodeps )
                                        end
                                end
 
-                               v = tonumber(v)
-
+                               local w = tonumber(v)
+                               
                                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))
                                        end
                                end
 
                                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))
                                        end
                                end
index a575f40599b228a8e26cb8274b5dffb9c82491b6..614100fcef529b1addf667b0723834a604257b18 100644 (file)
@@ -193,7 +193,11 @@ function error.is_all(self, ...)
        else
                local equal = false
                for _, c in ipairs(self.childs) do
-                       equal = util.contains(codes, c.code)
+                       if c.childs then
+                               equal = c:is_all(...)
+                       else
+                               equal = util.contains(codes, c.code)
+                       end
                end
                return equal
        end