self.config = map.config
self.optionals = {}
self.defaults = {}
- self.cast = "string"
self.optional = true
self.addremove = false
-- Returns the section's UCI table
function AbstractSection.cfgvalue(self, section)
- local value = self.map:get(section)
- if not self.cast or self.cast == type(value) then
- return value
- elseif self.cast == "string" then
- if type(value) == "table" then
- return value[1]
- end
- elseif self.cast == "table" then
- return {value}
- end
+ return self.map:get(section)
end
-- Removes the section
crval = REMOVE_PREFIX .. self.config
name = luci.http.formvaluetable(crval)
for k,v in pairs(name) do
+ luci.util.perror(k)
+ luci.util.perror(self:cfgvalue(k))
+ luci.util.perror(self:checkscope(k))
if self:cfgvalue(k) and self:checkscope(k) then
self:remove(k)
end
self.tag_missing = {}
self.tag_error = {}
self.deps = {}
+ self.cast = "string"
self.track_missing = false
self.rmempty = false
-- Return the UCI value of this object
function AbstractValue.cfgvalue(self, section)
- return self.map:get(section, self.option)
+ local value = self.map:get(section, self.option)
+ if not self.cast or self.cast == type(value) then
+ return value
+ elseif self.cast == "string" then
+ if type(value) == "table" then
+ return value[1]
+ end
+ elseif self.cast == "table" then
+ return {value}
+ end
end
-- Validate the form value