summaryrefslogtreecommitdiffstats
path: root/aconf/model/net.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/model/net.lua')
-rw-r--r--aconf/model/net.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/aconf/model/net.lua b/aconf/model/net.lua
index 48a419a..268e60e 100644
--- a/aconf/model/net.lua
+++ b/aconf/model/net.lua
@@ -54,23 +54,22 @@ function BaseIPAddress:split(context, value)
return comps[1], mask
end
-function BaseIPAddress:_load(context)
- local res = super(self, BaseIPAddress):_load(context)
+function BaseIPAddress:decode(context, value)
local maddr = self:abs_mask_addr(context)
- if res and maddr then
- return res..'/'..(self:mask2cidr(context.txn:get(maddr)) or self.length)
+ if value and maddr then
+ return value..'/'..(self:mask2cidr(context.txn:get(maddr)) or self.length)
end
- return res
+ return value
end
-function BaseIPAddress:_save(context, value)
+function BaseIPAddress:encode(context, value)
local maddr = self:abs_mask_addr(context)
if maddr then
local cidr
if value then value, cidr = self:split(context, value) end
context.txn:set(maddr, cidr and self:cidr2mask(cidr))
end
- super(self, BaseIPAddress):_save(context, value)
+ return value
end