get_home_by_path is a public method
This commit is contained in:
parent
15beeda0f0
commit
9e81ae4737
@ -154,7 +154,7 @@ class Config(object):
|
||||
self.__dict__[name] = value
|
||||
return
|
||||
if '.' in name:
|
||||
homeconfig, name = self._cfgimpl_get_home_by_path(name)
|
||||
homeconfig, name = self.cfgimpl_get_home_by_path(name)
|
||||
return setattr(homeconfig, name, value)
|
||||
if type(getattr(self._cfgimpl_descr, name)) != SymLinkOption:
|
||||
self._validate(name, getattr(self._cfgimpl_descr, name))
|
||||
@ -206,7 +206,7 @@ class Config(object):
|
||||
# attribute access by passing a path,
|
||||
# for instance getattr(self, "creole.general.family.adresse_ip_eth0")
|
||||
if '.' in name:
|
||||
homeconfig, name = self._cfgimpl_get_home_by_path(name)
|
||||
homeconfig, name = self.cfgimpl_get_home_by_path(name)
|
||||
return homeconfig._getattr(name, permissive)
|
||||
opt_or_descr = getattr(self._cfgimpl_descr, name)
|
||||
# symlink options
|
||||
@ -248,7 +248,7 @@ class Config(object):
|
||||
:returns: Option()
|
||||
"""
|
||||
if '.' in path:
|
||||
homeconfig, path = self._cfgimpl_get_home_by_path(path)
|
||||
homeconfig, path = self.cfgimpl_get_home_by_path(path)
|
||||
return getattr(homeconfig._cfgimpl_descr, path)
|
||||
return getattr(self._cfgimpl_descr, path)
|
||||
|
||||
@ -273,7 +273,7 @@ class Config(object):
|
||||
candidates = [p for p in all_paths if p[-len(key_p):] == key_p]
|
||||
if len(candidates) == 1:
|
||||
name = '.'.join(candidates[0])
|
||||
homeconfig, name = self._cfgimpl_get_home_by_path(name)
|
||||
homeconfig, name = self.cfgimpl_get_home_by_path(name)
|
||||
try:
|
||||
getattr(homeconfig, name)
|
||||
except MandatoryError:
|
||||
@ -313,7 +313,7 @@ class Config(object):
|
||||
raise e
|
||||
raise NotFoundError("option {0} not found in config".format(name))
|
||||
|
||||
def _cfgimpl_get_home_by_path(self, path):
|
||||
def cfgimpl_get_home_by_path(self, path):
|
||||
""":returns: tuple (config, name)"""
|
||||
path = path.split('.')
|
||||
for step in path[:-1]:
|
||||
@ -337,7 +337,7 @@ class Config(object):
|
||||
# ______________________________________________________________________
|
||||
# def cfgimpl_previous_value(self, path):
|
||||
# "stores the previous value"
|
||||
# home, name = self._cfgimpl_get_home_by_path(path)
|
||||
# home, name = self.cfgimpl_get_home_by_path(path)
|
||||
# # FIXME fucking name
|
||||
# return home._cfgimpl_context._cfgimpl_values.previous_values[name]
|
||||
|
||||
|
@ -578,7 +578,7 @@ def apply_requires(opt, config, permissive=False):
|
||||
raise RequirementRecursionError("malformed requirements "
|
||||
"imbrication detected for option: '{0}' "
|
||||
"with requirement on: '{1}'".format(path, name))
|
||||
homeconfig, shortname = rootconfig._cfgimpl_get_home_by_path(name)
|
||||
homeconfig, shortname = rootconfig.cfgimpl_get_home_by_path(name)
|
||||
try:
|
||||
value = homeconfig._getattr(shortname, permissive=True)
|
||||
except PropertiesOptionError, err:
|
||||
|
Loading…
Reference in New Issue
Block a user