symlink has an option's API
This commit is contained in:
parent
43af9cf7f7
commit
2dfc906966
|
@ -373,20 +373,19 @@ class StrOption(Option):
|
||||||
class SymLinkOption(object):
|
class SymLinkOption(object):
|
||||||
opt_type = 'symlink'
|
opt_type = 'symlink'
|
||||||
|
|
||||||
def __init__(self, name, path):
|
def __init__(self, name, path, opt):
|
||||||
self._name = name
|
self._name = name
|
||||||
self.path = path
|
self.path = path
|
||||||
|
self.opt = opt
|
||||||
|
|
||||||
def setoption(self, config, value, who):
|
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):
|
def __getattr__(self, name):
|
||||||
if name not in ('setoption', 'getkey'):
|
if name in ('_name', 'path', 'opt', 'setoption'):
|
||||||
raise TypeError("shall not call {0} method/attribute on "
|
return self.__dict__[name]
|
||||||
"SymLinkOption {1}".format(name, self._name))
|
else:
|
||||||
|
return getattr(self.opt, name)
|
||||||
def getkey(self, value):
|
|
||||||
return value
|
|
||||||
|
|
||||||
class IPOption(Option):
|
class IPOption(Option):
|
||||||
opt_type = 'ip'
|
opt_type = 'ip'
|
||||||
|
|
Loading…
Reference in New Issue