projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9ce798a
)
luci-base: dispatcher: let attr() automatically serialize JSON
author
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 10 Feb 2016 18:30:43 +0000
(19:30 +0100)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 10 Feb 2016 18:31:10 +0000
(19:31 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/luci-base/luasrc/dispatcher.lua
patch
|
blob
|
history
diff --git
a/modules/luci-base/luasrc/dispatcher.lua
b/modules/luci-base/luasrc/dispatcher.lua
index 91a4c63a67fef5b185b68a1935c2d90e328f7825..c7903e6384e7a2f07f2952d352fddbf02aee9f25 100644
(file)
--- 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