From 271d8d08c08c1bbae92cc643491e7787ba204e8b Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Tue, 25 Mar 2014 09:02:23 +0200 Subject: model: allow assgining relative paths to reference fields --- aconf/model/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'aconf/model') diff --git a/aconf/model/init.lua b/aconf/model/init.lua index c0b5998..a4c7a4b 100644 --- a/aconf/model/init.lua +++ b/aconf/model/init.lua @@ -155,9 +155,9 @@ function M.Reference:normalize(context, value) if type(value) ~= 'string' then raise(path, 'Path name must be string') end local rel = value + local scope = self:abs_scope(context) if M.path.is_absolute(rel) then - local scope = self:abs_scope(context) local prefix = scope..'/' if not stringy.startswith(rel, prefix) then raise(path, 'Reference out of scope ('..scope..')') @@ -168,7 +168,7 @@ function M.Reference:normalize(context, value) -- TODO check instance type relabel(path, self.follow, self, context, rel) - return self.dereference and value or rel + return self.dereference and M.path.to_absolute(value, scope) or rel end function M.Reference:deleted(context, addr) -- cgit v1.2.3