summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-10 16:34:19 +0100
committerspag <spag@golwen.net>2013-01-10 16:34:19 +0100
commit7326afdd65ae58c7158249c9ea73eaf0db16bbd3 (patch)
treea59822c77692ffa1947f35d4df0d3442b246395e
parentf34c48f4922faa4e433212747347ad7319942699 (diff)
strip whitespace
-rw-r--r--misc/freeswitch/scripts/common/configuration_table.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/misc/freeswitch/scripts/common/configuration_table.lua b/misc/freeswitch/scripts/common/configuration_table.lua
index 731bf2f..85bc014 100644
--- a/misc/freeswitch/scripts/common/configuration_table.lua
+++ b/misc/freeswitch/scripts/common/configuration_table.lua
@@ -21,17 +21,20 @@ function get(database, entity, section)
local parameter_class = '';
database:query(sql_query, function(parameters)
- if not root[parameters.section] then
- root[parameters.section] = {};
+ local p_section = common.str.strip(parameters.section):lower();
+ local p_class_type = common.str.strip(parameters.class_type):lower();
+ local p_name = common.str.strip(parameters.name);
+
+ if not root[p_section] then
+ root[p_section] = {};
end
- parameter_class = tostring(parameters.class_type):lower();
- if parameter_class == 'boolean' then
- root[parameters.section][parameters.name] = common.str.to_b(parameters.value);
- elseif parameter_class == 'integer' then
- root[parameters.section][parameters.name] = common.str.to_i(parameters.value);
+ if p_class_type == 'boolean' then
+ root[p_section][p_name] = common.str.to_b(parameters.value);
+ elseif p_class_type == 'integer' then
+ root[p_section][p_name] = common.str.to_i(parameters.value);
else
- root[parameters.section][parameters.name] = tostring(parameters.value);
+ root[p_section][p_name] = tostring(parameters.value);
end
end)