webmcp

diff framework/env/execute/action.lua @ 352:2b5bdf9028fb

Code cleanup and performance improvements regarding 404 check; Deprecated encode.action_file_path{...} and encode.view_file_path{...}
author jbe
date Thu Mar 26 16:40:04 2015 +0100 (2015-03-26)
parents eb3e236d261d
children f28b3c671378
line diff
     1.1 --- a/framework/env/execute/action.lua	Thu Mar 26 16:38:30 2015 +0100
     1.2 +++ b/framework/env/execute/action.lua	Thu Mar 26 16:40:04 2015 +0100
     1.3 @@ -1,10 +1,11 @@
     1.4  --[[--
     1.5 -action_status =     -- status code returned by the action (a string)
     1.6 +action_status =     -- status code returned by the action (a string), or, if "test_existence" == true, a boolean
     1.7  execute.action{
     1.8 -  module = module,  -- module name of the action to be executed
     1.9 -  action = action,  -- name of the action to be executed
    1.10 -  id     = id,      -- id to be returned by param.get_id(...) during execution
    1.11 -  params = params   -- parameters to be returned by param.get(...) during execution
    1.12 +  module         = module,         -- module name of the action to be executed
    1.13 +  action         = action,         -- name of the action to be executed
    1.14 +  id             = id,             -- id to be returned by param.get_id(...) during execution
    1.15 +  params         = params,         -- parameters to be returned by param.get(...) during execution
    1.16 +  test_existence = test_existence  -- do not execute action but only check if it exists
    1.17  }
    1.18  
    1.19  Executes an action without associated filters.
    1.20 @@ -14,14 +15,20 @@
    1.21  function execute.action(args)
    1.22    local module = args.module
    1.23    local action = args.action
    1.24 -  trace.enter_action{ module = module, action = action }
    1.25 +  local test   = args.test_existence
    1.26 +  if not test then
    1.27 +    trace.enter_action{ module = module, action = action }
    1.28 +  end
    1.29    local action_status = execute.file_path{
    1.30      file_path = encode.file_path(
    1.31        WEBMCP_BASE_PATH, 'app', WEBMCP_APP_NAME, module, '_action', action .. '.lua'
    1.32      ),
    1.33      id     = args.id,
    1.34 -    params = args.params
    1.35 +    params = args.params,
    1.36 +    test_existence = test
    1.37    }
    1.38 -  trace.execution_return{ status = action_status }
    1.39 +  if not test then
    1.40 +    trace.execution_return{ status = action_status }
    1.41 +  end
    1.42    return action_status
    1.43  end

Impressum / About Us