libs/web: Turn dependency tracking on by default
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index e3dc637..09e99e7 100644 (file)
@@ -171,6 +171,7 @@ function dispatch(request)
                viewns.REQUEST_URI = (luci.http.getenv("SCRIPT_NAME") or "") .. (luci.http.getenv("PATH_INFO") or "")
        end
        
+       track.dependent = (track.dependent ~= false)
        assert(not track.dependent or not track.auto, "Access Violation")
        
        if track.sysauth then
@@ -182,7 +183,7 @@ function dispatch(request)
                 
                local def  = (type(track.sysauth) == "string") and track.sysauth
                local accs = def and {track.sysauth} or track.sysauth
-               local sess = luci.http.getcookie("sysauth")
+               local sess = ctx.authsession or luci.http.getcookie("sysauth")
                sess = sess and sess:match("^[A-F0-9]+$")
                local user = sauth.read(sess)
                
@@ -197,6 +198,7 @@ function dispatch(request)
                                        if not sess then
                                                sauth.write(sid, user)
                                        end
+                                       ctx.authsession = sid
                                end
                        else
                                luci.http.status(403, "Forbidden")
@@ -464,18 +466,10 @@ function cbi(model)
                require("luci.cbi")
                require("luci.template")
 
-               local stat, maps = luci.util.copcall(luci.cbi.load, model, ...)
-               if not stat then
-                       error500(maps)
-                       return true
-               end
+               maps = luci.cbi.load(model, ...)
 
                for i, res in ipairs(maps) do
-                       local stat, err = luci.util.copcall(res.parse, res)
-                       if not stat then
-                               error500(err)
-                               return true
-                       end
+                       res:parse()
                end
 
                luci.template.render("cbi/header")
@@ -493,18 +487,10 @@ function form(model)
                require("luci.cbi")
                require("luci.template")
 
-               local stat, maps = luci.util.copcall(luci.cbi.load, model, ...)
-               if not stat then
-                       error500(maps)
-                       return true
-               end
+               maps = luci.cbi.load(model, ...)
 
                for i, res in ipairs(maps) do
-                       local stat, err = luci.util.copcall(res.parse, res)
-                       if not stat then
-                               error500(err)
-                               return true
-                       end
+                       res:parse()
                end
 
                luci.template.render("header")