From c918191d2113efe34419a52c91fa4894e4834909 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 4 Apr 2013 15:14:16 +0200 Subject: [PATCH] permissives are for a specified option not config --- tiramisu/config.py | 16 +++++----------- tiramisu/setting.py | 8 ++++---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/tiramisu/config.py b/tiramisu/config.py index f42dfb2..14c0985 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -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" @@ -117,8 +117,8 @@ class SubConfig(object): # for instance getattr(self, "creole.general.family.adresse_ip_eth0") if '.' in name: homeconfig, name = self.cfgimpl_get_home_by_path(name, - force_permissive=force_permissive, - force_properties=force_properties) + 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) @@ -155,8 +155,8 @@ class SubConfig(object): path = path.split('.') for step in path[:-1]: self = self._getattr(step, - force_permissive=force_permissive, - force_properties=force_properties) + force_permissive=force_permissive, + force_properties=force_properties) return self, path[-1] def _cfgimpl_get_path(self): @@ -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 = [] diff --git a/tiramisu/setting.py b/tiramisu/setting.py index 90918f0..964ec81 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -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):