summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-02-10 19:30:43 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-02-10 19:31:10 +0100
commit8f409a45abb8cc4fda068c6a24085c467f3e37d8 (patch)
tree47a232199c939b329602e17619951bf3298285e5 /modules/luci-base/luasrc/dispatcher.lua
parent9ce798abd4da80a5769f493a3aea729781cfae97 (diff)
luci-base: dispatcher: let attr() automatically serialize JSON
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc/dispatcher.lua')
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index 91a4c63a67..c7903e6384 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -273,6 +273,13 @@ function dispatch(request)
if cond then
local env = getfenv(3)
local scope = (type(env.self) == "table") and env.self
+ if type(val) == "table" then
+ if not next(val) then
+ return ''
+ else
+ val = util.serialize_json(val)
+ end
+ end
return string.format(
' %s="%s"', tostring(key),
util.pcdata(tostring( val