luci-base: dispatcher: let attr() automatically serialize JSON
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
9ce798abd4
commit
8f409a45ab
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue