luci-0.9: fix various uvl issues

This commit is contained in:
Jo-Philipp Wich
2010-04-05 17:44:57 +00:00
parent f77d92b2be
commit 119aeff2c7
3 changed files with 5 additions and 5 deletions

View File

@@ -278,7 +278,7 @@ function UVL._validate_section( self, section )
if STRICT_UNKNOWN_OPTIONS and not section:scheme('dynamic') then if STRICT_UNKNOWN_OPTIONS and not section:scheme('dynamic') then
for k, v in pairs(section:config()) do for k, v in pairs(section:config()) do
local oo = section:option(k) 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)) section:error(ERR('OPT_UNKNOWN', oo))
end end
end end

View File

@@ -19,8 +19,8 @@ local uvl = require "luci.uvl"
local util = require "luci.util" local util = require "luci.util"
local string = require "string" local string = require "string"
local luci, tonumber, unpack, ipairs, type = local luci, tonumber, tostring, unpack, ipairs, type =
luci, tonumber, unpack, ipairs, type luci, tonumber, tostring, unpack, ipairs, type
module "luci.uvl.errors" module "luci.uvl.errors"
@@ -128,7 +128,7 @@ function error.string(self,pad)
:gsub("%%s", self.section or '(nil)') :gsub("%%s", self.section or '(nil)')
:gsub("%%S", self.stype or '(nil)') :gsub("%%S", self.stype or '(nil)')
:gsub("%%o", self.option 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:type() or '(nil)' )
:gsub("%%T", self.object and self.object:title() 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) :gsub("%%([1-9])", function(n) return self.args[tonumber(n)] or '(nil)' end)

View File

@@ -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]) ) 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 else
ok, err = uvl:validate( unpack(cso) ) ok, err = uvl:validate( unpack(cso) )
end end