diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-06 16:24:59 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-06 16:24:59 +0200 |
commit | 3c3a00f819b424714e615c15556832781b4b7446 (patch) | |
tree | a9072cb37b1ee6d66d87eb7ae0c09291ddb703fc /acf2/transaction | |
parent | 3d0628ff82fea853fdb5b033a16ea0f9bcfb653d (diff) | |
download | aconf-3c3a00f819b424714e615c15556832781b4b7446.tar.bz2 aconf-3c3a00f819b424714e615c15556832781b4b7446.tar.xz |
transaction: suppress validation for subordinates of deleted objects
Diffstat (limited to 'acf2/transaction')
-rw-r--r-- | acf2/transaction/init.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/acf2/transaction/init.lua b/acf2/transaction/init.lua index 627703c..ec8da59 100644 --- a/acf2/transaction/init.lua +++ b/acf2/transaction/init.lua @@ -75,9 +75,19 @@ function Transaction:set_multiple(mods) local addr, value = unpack(mod) if value == nil then for _, val in ipairs{self.validable, self.commit_val} do - for path, a in pairs(val) do - if a == addr then val[path] = nil end - end + local done + repeat + done = true + for path, a in pairs(copy(val)) do + if a == addr then + for p, _ in pairs(copy(val)) do + if pth.is_subordinate(p, path) then val[p] = nil end + end + done = false + break + end + end + until done end end end |