summaryrefslogtreecommitdiffstats
path: root/aconf/model/model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/model/model.lua')
-rw-r--r--aconf/model/model.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/aconf/model/model.lua b/aconf/model/model.lua
index 7ce3060..e71e73c 100644
--- a/aconf/model/model.lua
+++ b/aconf/model/model.lua
@@ -177,6 +177,11 @@ function M.Model:init(context)
function mt.removable() return self:is_removable() end
end
+ local value_removable = mt.value_removable
+ function mt.value_removable(v)
+ return type(v) == 'table' and value_removable(v)
+ end
+
if not mt.txn then return end
@@ -184,8 +189,9 @@ function M.Model:init(context)
function mt.save(k, v)
k = normalize_name(k)
- mt.check_removable(k, v)
- return mt.member(k, false, Field):save(v)
+ local field = mt.member(k, false, Field)
+ if isinstance(field, fld.TreeNode) then mt.check_removable(k, v) end
+ return field:save(v)
end
local function tmeta(tpe)
@@ -197,7 +203,7 @@ function M.Model:init(context)
end
function mt.members()
- return map(function(f) return f.name end, mt.meta().fields)
+ return map(function(f) return f.name end, tmeta(Field))
end
function mt.validate()