mirror of
https://github.com/openwrt/luci.git
synced 2026-08-28 05:46:45 +04:00
luci-base: dispatcher: let attr() automatically serialize JSON
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user