self.beenthere = { }
if not co:config() then
- return false, ERR.UCILOAD(co)
+ return false, co:errors()
end
local function _uci_foreach( type, func )
self.beenthere = { }
if not co:config() then
- return false, ERR.UCILOAD(co)
+ return false, co:errors()
end
if so:config() then
local so = co:section( section )
local oo = so:option( option )
- if not co then
- return false, oerr:child(ERR.UCILOAD(config))
+ if not co:config() then
+ return false, co:errors()
end
if so:config() and oo:config() then
local uci = luci.model.uci.cursor()
uci:set_confdir( luci.fs.dirname(file) )
- local sd = uci:get_all( luci.fs.basename(file) )
+ local sd, err = uci:get_all( luci.fs.basename(file) )
if not sd then
- return false, ERR.UCILOAD(so)
+ return false, ERR.UCILOAD(so, err)
end
table.insert( schemes, sd )
if #ref == 2 or #ref == 3 then
local co = luci.uvl.config( self, ref[1] )
- if not co:config() then return false, ERR.UCILOAD(ref[1]) end
+ if not co:config() then return false, co:errors() end
for k, v in pairs(co:config()) do
if v['.type'] == ref[2] then
end
end
+function uvlitem._loadconf(self, co, c)
+ if not co then
+ local uci, err = luci.model.uci.cursor(), nil
+ co, err = uci:get_all(c)
+
+ if err then
+ self:error(ERR.UCILOAD(self, err))
+ end
+ end
+ return co
+end
+
--- Object representation of a scheme.
-- @class scheme
c, co = co, nil
end
- if not co then
- local uci = luci.model.uci.cursor()
- co = uci:get_all(c)
- end
-
self.cref = { c }
self.sref = { c }
- self.c = co
+ self.c = self:_loadconf(co, c)
self.s = scheme
self.t = luci.uvl.TYPE_SCHEME
end
c, co = co, nil
end
- if not co then
- local uci = luci.model.uci.cursor()
- co = uci:get_all(c)
- end
-
self.cref = { c }
self.sref = { c }
- self.c = co
+ self.c = self:_loadconf(co, c)
self.s = scheme
self.t = luci.uvl.TYPE_CONFIG
end
function section.__init__(self, scheme, co, c, s)
self.cref = { c, s }
self.sref = { c, co and co[s] and co[s]['.type'] or s }
- self.c = co
+ self.c = self:_loadconf(co, c)
self.s = scheme
self.t = luci.uvl.TYPE_SECTION
end
function option.__init__(self, scheme, co, c, s, o)
self.cref = { c, s, o }
self.sref = { c, co and co[s] and co[s]['.type'] or s, o }
- self.c = co
+ self.c = self:_loadconf(co, c)
self.s = scheme
self.t = luci.uvl.TYPE_OPTION
end
function enum.__init__(self, scheme, co, c, s, o, v)
self.cref = { c, s, o, v }
self.sref = { c, co and co[s] and co[s]['.type'] or s, o, v }
- self.c = co
+ self.c = self:_loadconf(co, c)
self.s = scheme
self.t = luci.uvl.TYPE_ENUM
end