luci-base: dispatcher: let attr() automatically serialize JSON

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2016-02-10 19:30:43 +01:00
parent 9ce798abd4
commit 8f409a45ab

View file

@ -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