permissives are for a specified option not config

This commit is contained in:
Emmanuel Garette 2013-04-04 15:14:16 +02:00
parent 9006dca09f
commit c918191d21
2 changed files with 9 additions and 15 deletions

View File

@ -95,7 +95,7 @@ class SubConfig(object):
properties = properties & set_properties
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(self.cfgimpl_get_description()))
properties = properties - set(self.cfgimpl_get_settings().get_permissive(opt_or_descr))
properties = list(properties)
if properties != []:
raise PropertiesOptionError("trying to access"
@ -236,12 +236,6 @@ class SubConfig(object):
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):
"Config's string representation"
lines = []

View File

@ -205,13 +205,13 @@ class Setting(object):
self.set_properties(properties, opt)
#____________________________________________________________
def get_permissive(self, config=None):
return self.permissives.get(config, [])
def get_permissive(self, opt=None):
return self.permissives.get(opt, [])
def set_permissive(self, permissive, config=None):
def set_permissive(self, permissive, opt=None):
if not isinstance(permissive, list):
raise TypeError('permissive must be a list')
self.permissives[config] = permissive
self.permissives[opt] = permissive
#____________________________________________________________
def setowner(self, owner):