Speed up generation of dispatching tree

This commit is contained in:
Steven Barth 2008-08-29 20:36:45 +00:00
parent 53871726b5
commit 5cfda95377

View file

@ -449,17 +449,19 @@ end
--- Create a template render dispatching target. --- Create a template render dispatching target.
-- @param name Template to be rendered -- @param name Template to be rendered
function template(name) function template(name)
require("luci.template") return function()
return function() luci.template.render(name) end require("luci.template")
luci.template.render(name)
end
end end
--- Create a CBI model dispatching target. --- Create a CBI model dispatching target.
-- @param model CBI model tpo be rendered -- @param model CBI model tpo be rendered
function cbi(model) function cbi(model)
require("luci.cbi")
require("luci.template")
return function(...) return function(...)
require("luci.cbi")
require("luci.template")
local stat, maps = luci.util.copcall(luci.cbi.load, model, ...) local stat, maps = luci.util.copcall(luci.cbi.load, model, ...)
if not stat then if not stat then
error500(maps) error500(maps)
@ -485,10 +487,10 @@ end
--- Create a CBI form model dispatching target. --- Create a CBI form model dispatching target.
-- @param model CBI form model tpo be rendered -- @param model CBI form model tpo be rendered
function form(model) function form(model)
require("luci.cbi")
require("luci.template")
return function(...) return function(...)
require("luci.cbi")
require("luci.template")
local stat, maps = luci.util.copcall(luci.cbi.load, model, ...) local stat, maps = luci.util.copcall(luci.cbi.load, model, ...)
if not stat then if not stat then
error500(maps) error500(maps)