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
1 changed files with 9 additions and 4 deletions

View File

@ -116,8 +116,11 @@ class SubConfig(object):
# attribute access by passing a path, # attribute access by passing a path,
# for instance getattr(self, "creole.general.family.adresse_ip_eth0") # for instance getattr(self, "creole.general.family.adresse_ip_eth0")
if '.' in name: 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) 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) opt_or_descr = getattr(self._cfgimpl_descr, name)
# symlink options # symlink options
if type(opt_or_descr) == SymLinkOption: if type(opt_or_descr) == SymLinkOption:
@ -147,11 +150,13 @@ class SubConfig(object):
child = getattr(self._cfgimpl_descr, name) child = getattr(self._cfgimpl_descr, name)
child.setoption(self, value) 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)""" """:returns: tuple (config, name)"""
path = path.split('.') path = path.split('.')
for step in path[:-1]: 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] return self, path[-1]
def _cfgimpl_get_path(self): def _cfgimpl_get_path(self):