From 2dfc906966befdafb772ee85fef19eaa18c2a360 Mon Sep 17 00:00:00 2001 From: gwen Date: Fri, 30 Nov 2012 16:23:40 +0100 Subject: [PATCH] symlink has an option's API --- tiramisu/option.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tiramisu/option.py b/tiramisu/option.py index 59b0bdb..1af3a81 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -373,20 +373,19 @@ class StrOption(Option): class SymLinkOption(object): opt_type = 'symlink' - def __init__(self, name, path): + def __init__(self, name, path, opt): self._name = name self.path = path + self.opt = opt def setoption(self, config, value, who): - setattr(config, self.path, value) # .setoption(self.path, value, who) + setattr(config, self.path, value) def __getattr__(self, name): - if name not in ('setoption', 'getkey'): - raise TypeError("shall not call {0} method/attribute on " - "SymLinkOption {1}".format(name, self._name)) - - def getkey(self, value): - return value + if name in ('_name', 'path', 'opt', 'setoption'): + return self.__dict__[name] + else: + return getattr(self.opt, name) class IPOption(Option): opt_type = 'ip'