[luci] luci crashing when too much values in a ListValue

Pau hakais at gmail.com
Tue Aug 2 19:31:56 CEST 2011


Hi.
I am playing a little with CBI models, but I have a problem.
I have this code inside my model:


-----------------------------------------------------------------------------------
channel = s_wireless:option(ListValue,"channel","Channel")
channel:value("0","0")

function channel.cfgvalue(self, section)
    local dev = m.uci:get("qmp", section, "device")
    for _,ch in ipairs(luci.sys.wifi.channels(dev)) do
        channel:value(ch.channel, ch.channel)
    end
    return ListValue.cfgvalue(self, section)
end
-----------------------------------------------------------------------------------

When LuCi is trying to show this page, still thinking all the time showing
nothing.
However If I change my code:

-----------------------------------------------------------------------------------
channel = s_wireless:option(ListValue,"channel","Channel")
channel:value("0","0")

function channel.cfgvalue(self, section)
    local dev = m.uci:get("qmp", section, "device")

    f = io.open("/tmp/debug_luci","w")
    f:write(dev)
    f:write("\n")

    for _,ch in ipairs(luci.sys.wifi.channels(dev)) do
        -- channel:value(ch.channel, ch.channel)
        f:write(ch.channel .. "\n")
    end
    f:close()
    return ListValue.cfgvalue(self, section)
end
-----------------------------------------------------------------------------------

The page is loaded, it shows as channel value '0' only, and I can see all
the channels in file /tmp/debug_luci (then the channels array is good)
So the problem is channel:value(), maybe am I putting too much values?

Any ideas? do you know any other way to do that?

Thanks

--
./p4u
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20110802/6c30c313/attachment.html>


More information about the luci mailing list