webmcp
diff framework/env/execute/view.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 | 2cb27106aa73 |
| children | f28b3c671378 |
line diff
1.1 --- a/framework/env/execute/view.lua Thu Mar 26 16:38:30 2015 +0100 1.2 +++ b/framework/env/execute/view.lua Thu Mar 26 16:40:04 2015 +0100 1.3 @@ -1,9 +1,11 @@ 1.4 --[[-- 1.5 +view_exists = -- boolean returned if "test_existence" is set to true, otherwise no value returned 1.6 execute.view{ 1.7 module = module, -- module name of the view to be executed 1.8 view = view, -- name of the view to be executed 1.9 id = id, -- id to be returned by param.get_id(...) during execution 1.10 - params = params -- parameters to be returned by param.get(...) during execution 1.11 + params = params, -- parameters to be returned by param.get(...) during execution 1.12 + test_existence = test_existence -- do not execute view but only check if it exists 1.13 } 1.14 1.15 Executes a view directly (without associated filters). 1.16 @@ -12,14 +14,23 @@ 1.17 1.18 function execute.view(args) 1.19 local module = args.module 1.20 - local view = args.view 1.21 - trace.enter_view{ module = module, view = view } 1.22 - execute.file_path{ 1.23 + local view = args.view 1.24 + local test = args.test_existence 1.25 + if not test then 1.26 + trace.enter_view{ module = module, view = view } 1.27 + end 1.28 + local result = execute.file_path{ 1.29 file_path = encode.file_path( 1.30 WEBMCP_BASE_PATH, 'app', WEBMCP_APP_NAME, module, view .. '.lua' 1.31 ), 1.32 id = args.id, 1.33 - params = args.params 1.34 + params = args.params, 1.35 + test_existence = test 1.36 } 1.37 - trace.execution_return() 1.38 + if not test then 1.39 + trace.execution_return() 1.40 + end 1.41 + if test then 1.42 + return result 1.43 + end 1.44 end