webmcp

view framework/env/execute/_add_filters_by_path.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children a54cc7dcabf1
line source
1 function execute._add_filters_by_path(filter_list, ...)
2 local full_path = encode.file_path(request.get_app_basepath(), "app", ...)
3 local relative_path = encode.file_path("", ...)
4 local filter_names = os.listdir(full_path)
5 if filter_names then
6 table.sort(filter_names) -- not really neccessary, due to sorting afterwards
7 for i, filter_name in ipairs(filter_names) do
8 if string.find(filter_name, "%.lua$") then
9 if filter_list[filter_name] then
10 error('More than one filter is named "' .. filter_name .. '".')
11 end
12 table.insert(filter_list, filter_name)
13 filter_list[filter_name] = function()
14 trace.enter_filter{
15 path = encode.file_path(relative_path, filter_name)
16 }
17 execute.file_path{
18 file_path = encode.file_path(full_path, filter_name)
19 }
20 trace.execution_return()
21 end
22 end
23 end
24 end
25 end

Impressum / About Us