summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/template.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/luasrc/template.lua')
-rw-r--r--modules/luci-base/luasrc/template.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/luci-base/luasrc/template.lua b/modules/luci-base/luasrc/template.lua
index cd9b73b22b..3955bd76f3 100644
--- a/modules/luci-base/luasrc/template.lua
+++ b/modules/luci-base/luasrc/template.lua
@@ -53,7 +53,7 @@ function Template.__init__(self, name, template)
-- Create a new namespace for this template
self.viewns = context.viewns
-
+
-- If we have a cached template, skip compiling and loading
if not self.template then
@@ -84,13 +84,13 @@ end
-- Renders a template
function Template.render(self, scope)
scope = scope or getfenv(2)
-
+
-- Put our predefined objects in the scope of the template
setfenv(self.template, setmetatable({}, {__index =
function(tbl, key)
return rawget(tbl, key) or self.viewns[key] or scope[key]
end}))
-
+
-- Now finally render the thing
local stat, err = util.copcall(self.template)
if not stat then