set permissive to cfgimpl_get_home_by_path

This commit is contained in:
Emmanuel Garette 2013-04-04 12:16:18 +02:00
parent e9902d8ce2
commit 9006dca09f

View File

@ -116,8 +116,11 @@ class SubConfig(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)
return homeconfig._getattr(name)
homeconfig, name = self.cfgimpl_get_home_by_path(name,
force_permissive=force_permissive,
force_properties=force_properties)
return homeconfig._getattr(name, force_permissive=force_permissive,
force_properties=force_properties)
opt_or_descr = getattr(self._cfgimpl_descr, name)
# symlink options
if type(opt_or_descr) == SymLinkOption:
@ -147,11 +150,13 @@ class SubConfig(object):
child = getattr(self._cfgimpl_descr, name)
child.setoption(self, value)
def cfgimpl_get_home_by_path(self, path):
def cfgimpl_get_home_by_path(self, path, force_permissive=False, force_properties=None):
""":returns: tuple (config, name)"""
path = path.split('.')
for step in path[:-1]:
self = getattr(self, step)
self = self._getattr(step,
force_permissive=force_permissive,
force_properties=force_properties)
return self, path[-1]
def _cfgimpl_get_path(self):