libs/web: don't send Status: 500 in error500() if header is already sent
modules/admin-core: include template header only once
This commit is contained in:
parent
8dbb8a0ad3
commit
b5026e65c0
2 changed files with 16 additions and 8 deletions
|
@ -74,13 +74,15 @@ end
|
||||||
-- @param message Custom error message (optional)#
|
-- @param message Custom error message (optional)#
|
||||||
-- @return false
|
-- @return false
|
||||||
function error500(message)
|
function error500(message)
|
||||||
|
if not context.template_header_sent then
|
||||||
luci.http.status(500, "Internal Server Error")
|
luci.http.status(500, "Internal Server Error")
|
||||||
|
else
|
||||||
require("luci.template")
|
require("luci.template")
|
||||||
if not luci.util.copcall(luci.template.render, "error500", {message=message}) then
|
if not luci.util.copcall(luci.template.render, "error500", {message=message}) then
|
||||||
luci.http.prepare_content("text/plain")
|
luci.http.prepare_content("text/plain")
|
||||||
luci.http.write(message)
|
luci.http.write(message)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,10 @@ You may obtain a copy of the License at
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
-%>
|
-%>
|
||||||
<% include("themes/" .. theme .. "/header") %>
|
|
||||||
|
<%
|
||||||
|
if not luci.dispatcher.context.template_header_sent then
|
||||||
|
include("themes/" .. theme .. "/header")
|
||||||
|
luci.dispatcher.context.template_header_sent = true
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
Loading…
Reference in a new issue