luci-0.9: fix various uvl issues
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 5 Apr 2010 17:44:57 +0000 (17:44 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 5 Apr 2010 17:44:57 +0000 (17:44 +0000)
libs/uvl/luasrc/uvl.lua
libs/uvl/luasrc/uvl/errors.lua
libs/uvl/root/usr/bin/uvl

index d2ea4bd2c249a93d042a731d09a0816792d5230e..f9a93e6d18e38fc77af0043d9ef543b57b3f4c5d 100644 (file)
@@ -278,7 +278,7 @@ function UVL._validate_section( self, section )
        if STRICT_UNKNOWN_OPTIONS and not section:scheme('dynamic') then
                for k, v in pairs(section:config()) do
                        local oo = section:option(k)
-                       if k:byte(1) == 46 and not self.beenthere[oo:cid()] then
+                       if k:byte(1) ~= 46 and not self.beenthere[oo:cid()] then
                                section:error(ERR('OPT_UNKNOWN', oo))
                        end
                end
index fa177fb7635f86fa4c2e9e15a21425f157c28607..aa13317cc963c90daa2c6715bd694a74ab8ecb06 100644 (file)
@@ -19,8 +19,8 @@ local uvl = require "luci.uvl"
 local util = require "luci.util"
 local string = require "string"
 
-local luci, tonumber, unpack, ipairs, type =
-       luci, tonumber, unpack, ipairs, type
+local luci, tonumber, tostring, unpack, ipairs, type =
+       luci, tonumber, tostring, unpack, ipairs, type
 
 module "luci.uvl.errors"
 
@@ -128,7 +128,7 @@ function error.string(self,pad)
                :gsub("%%s", self.section or '(nil)')
                :gsub("%%S", self.stype   or '(nil)')
                :gsub("%%o", self.option  or '(nil)')
-               :gsub("%%v", self.value   or '(nil)')
+               :gsub("%%v", self.value  and tostring(self.value) or '(nil)')
                :gsub("%%t", self.object and self.object:type()  or '(nil)' )
                :gsub("%%T", self.object and self.object:title() or '(nil)' )
                :gsub("%%([1-9])", function(n) return self.args[tonumber(n)] or '(nil)' end)
index e5db5c304e3925cd06323ec9738ee14ace193f09..01813b3f3ace9e07f254d1af5a852c5eb0b940b2 100755 (executable)
@@ -216,7 +216,7 @@ elseif arguments[1] == "verify" or arguments[1] == "verify-scheme" then
                )
 
                ok, err = uvl:validate_config( cso[1], uci:get_all(cso[1]) )
-               if err then err.code = luci.uvl.errors.ERR_SCHEME end
+               if err then err.code = 'SCHEME' end
        else
                ok, err = uvl:validate( unpack(cso) )
        end