permissives are for a specified option not config
This commit is contained in:
parent
9006dca09f
commit
c918191d21
|
@ -95,7 +95,7 @@ class SubConfig(object):
|
||||||
properties = properties & set_properties
|
properties = properties & set_properties
|
||||||
if force_permissive is True or self.cfgimpl_get_settings().has_property('permissive'):
|
if force_permissive is True or self.cfgimpl_get_settings().has_property('permissive'):
|
||||||
properties = properties - set(self.cfgimpl_get_settings().get_permissive())
|
properties = properties - set(self.cfgimpl_get_settings().get_permissive())
|
||||||
properties = properties - set(self.cfgimpl_get_settings().get_permissive(self.cfgimpl_get_description()))
|
properties = properties - set(self.cfgimpl_get_settings().get_permissive(opt_or_descr))
|
||||||
properties = list(properties)
|
properties = list(properties)
|
||||||
if properties != []:
|
if properties != []:
|
||||||
raise PropertiesOptionError("trying to access"
|
raise PropertiesOptionError("trying to access"
|
||||||
|
@ -117,8 +117,8 @@ class SubConfig(object):
|
||||||
# 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,
|
||||||
force_permissive=force_permissive,
|
force_permissive=force_permissive,
|
||||||
force_properties=force_properties)
|
force_properties=force_properties)
|
||||||
return homeconfig._getattr(name, force_permissive=force_permissive,
|
return homeconfig._getattr(name, force_permissive=force_permissive,
|
||||||
force_properties=force_properties)
|
force_properties=force_properties)
|
||||||
opt_or_descr = getattr(self._cfgimpl_descr, name)
|
opt_or_descr = getattr(self._cfgimpl_descr, name)
|
||||||
|
@ -155,8 +155,8 @@ class SubConfig(object):
|
||||||
path = path.split('.')
|
path = path.split('.')
|
||||||
for step in path[:-1]:
|
for step in path[:-1]:
|
||||||
self = self._getattr(step,
|
self = self._getattr(step,
|
||||||
force_permissive=force_permissive,
|
force_permissive=force_permissive,
|
||||||
force_properties=force_properties)
|
force_properties=force_properties)
|
||||||
return self, path[-1]
|
return self, path[-1]
|
||||||
|
|
||||||
def _cfgimpl_get_path(self):
|
def _cfgimpl_get_path(self):
|
||||||
|
@ -236,12 +236,6 @@ class SubConfig(object):
|
||||||
pass
|
pass
|
||||||
# ______________________________________________________________________
|
# ______________________________________________________________________
|
||||||
|
|
||||||
def cfgimpl_set_permissive(self, permissive):
|
|
||||||
if not isinstance(permissive, list):
|
|
||||||
raise TypeError('permissive must be a list')
|
|
||||||
self.cfgimpl_get_settings().set_permissive(permissive, self.cfgimpl_get_description())
|
|
||||||
|
|
||||||
# ______________________________________________________________________
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"Config's string representation"
|
"Config's string representation"
|
||||||
lines = []
|
lines = []
|
||||||
|
|
|
@ -205,13 +205,13 @@ class Setting(object):
|
||||||
self.set_properties(properties, opt)
|
self.set_properties(properties, opt)
|
||||||
|
|
||||||
#____________________________________________________________
|
#____________________________________________________________
|
||||||
def get_permissive(self, config=None):
|
def get_permissive(self, opt=None):
|
||||||
return self.permissives.get(config, [])
|
return self.permissives.get(opt, [])
|
||||||
|
|
||||||
def set_permissive(self, permissive, config=None):
|
def set_permissive(self, permissive, opt=None):
|
||||||
if not isinstance(permissive, list):
|
if not isinstance(permissive, list):
|
||||||
raise TypeError('permissive must be a list')
|
raise TypeError('permissive must be a list')
|
||||||
self.permissives[config] = permissive
|
self.permissives[opt] = permissive
|
||||||
|
|
||||||
#____________________________________________________________
|
#____________________________________________________________
|
||||||
def setowner(self, owner):
|
def setowner(self, owner):
|
||||||
|
|
Loading…
Reference in New Issue