Tuned dispatcher behaviour
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index fd2be1e..8e8e190 100644 (file)
@@ -112,11 +112,14 @@ function httpdispatch(request)
        end
        
        luci.http.close()
+
+       --context._disable_memtrace()
 end
 
 --- Dispatches a LuCI virtual path.
 -- @param request      Virtual path
 function dispatch(request)
+       --context._disable_memtrace = require "luci.debug".trap_memtrace()
        local ctx = context
        ctx.path = request
        
@@ -349,17 +352,8 @@ function assign(path, clone, title, order)
        
        obj.title = title
        obj.order = order
-       
-       local c = context.tree
-       for k, v in ipairs(clone) do
-               if not c.nodes[v] then
-                       c.nodes[v] = {nodes={}}
-               end
 
-               c = c.nodes[v]
-       end
-       
-       setmetatable(obj, {__index = c})
+       setmetatable(obj, {__index = _create_node(clone)})
        
        return obj
 end
@@ -385,7 +379,7 @@ end
 -- @param      ...             Virtual path
 -- @return                     Dispatching tree node
 function node(...)
-       local c = _create_node(arg)
+       local c = _create_node({...})
 
        c.module = getfenv(2)._NAME
        c.path = arg