summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-04-06 12:07:01 +0200
committerJo-Philipp Wich <jo@mein.io>2018-04-06 12:07:49 +0200
commitbf71ae5f1b9eef61f61f917a5f24cbbdab418e70 (patch)
treee420271a44120f2eebfb3635c91e29e018c6906e /modules/luci-base
parent6f47c5657f827a6202ad9f1937358893d2722132 (diff)
luci-base: emit a warning if cbi() delegates a SimpleForm instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index 88f9440c5d..4866727572 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -816,7 +816,16 @@ local function _cbi(self, ...)
local state = nil
+ local i, res
for i, res in ipairs(maps) do
+ if util.instanceof(res, cbi.SimpleForm) then
+ io.stderr:write("Model %s returns SimpleForm but is dispatched via cbi(),\n"
+ % self.model)
+
+ io.stderr:write("please change %s to use the form() action instead.\n"
+ % table.concat(context.request, "/"))
+ end
+
res.flow = config
local cstate = res:parse()
if cstate and (not state or cstate < state) then
@@ -937,6 +946,7 @@ local function _form(self, ...)
local maps = luci.cbi.load(self.model, ...)
local state = nil
+ local i, res
for i, res in ipairs(maps) do
local cstate = res:parse()
if cstate and (not state or cstate < state) then