libs/web: fix dynamic list handling
This commit is contained in:
parent
02ad68a406
commit
2a0903bc50
1 changed files with 10 additions and 11 deletions
|
@ -1346,7 +1346,7 @@ function AbstractValue.cfgvalue(self, section)
|
||||||
return value[1]
|
return value[1]
|
||||||
end
|
end
|
||||||
elseif self.cast == "table" then
|
elseif self.cast == "table" then
|
||||||
return luci.util.split(value, "%s+", nil, true)
|
return { value }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1660,11 +1660,6 @@ function DynamicList.write(self, section, value)
|
||||||
t[#t+1] = x
|
t[#t+1] = x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif self.cast == "table" then
|
|
||||||
local x
|
|
||||||
for x in util.imatch(value) do
|
|
||||||
t[#t+1] = x
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
t = { value }
|
t = { value }
|
||||||
end
|
end
|
||||||
|
@ -1699,12 +1694,16 @@ function DynamicList.formvalue(self, section)
|
||||||
local value = AbstractValue.formvalue(self, section)
|
local value = AbstractValue.formvalue(self, section)
|
||||||
|
|
||||||
if type(value) == "string" then
|
if type(value) == "string" then
|
||||||
local x
|
if self.cast == "string" then
|
||||||
local t = { }
|
local x
|
||||||
for x in value:gmatch("%S+") do
|
local t = { }
|
||||||
t[#t+1] = x
|
for x in value:gmatch("%S+") do
|
||||||
|
t[#t+1] = x
|
||||||
|
end
|
||||||
|
value = t
|
||||||
|
else
|
||||||
|
value = { value }
|
||||||
end
|
end
|
||||||
value = t
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in a new issue