summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-25 09:02:23 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-25 09:02:23 +0200
commit271d8d08c08c1bbae92cc643491e7787ba204e8b (patch)
tree6dd687eb8437c21d69bf494c03af20c5b5dbcc05
parent9101e28911a1f8edae956e7376008a092c5b3add (diff)
downloadaconf-271d8d08c08c1bbae92cc643491e7787ba204e8b.tar.bz2
aconf-271d8d08c08c1bbae92cc643491e7787ba204e8b.tar.xz
model: allow assgining relative paths to reference fields
-rw-r--r--aconf/model/init.lua4
1 files changed, 2 insertions, 2 deletions
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)