only catch PropertiesOptionError

This commit is contained in:
Emmanuel Garette 2013-04-16 12:04:20 +02:00
parent 16801ad1b2
commit 6097f3af84
2 changed files with 8 additions and 9 deletions

View file

@ -203,7 +203,7 @@ class SubConfig(object):
yield child._name, getattr(self, child._name) yield child._name, getattr(self, child._name)
except GeneratorExit: except GeneratorExit:
raise StopIteration raise StopIteration
except: except PropertiesOptionError:
pass # option with properties pass # option with properties
def iter_all(self): def iter_all(self):
@ -214,7 +214,7 @@ class SubConfig(object):
yield child._name, getattr(self, child._name) yield child._name, getattr(self, child._name)
except GeneratorExit: except GeneratorExit:
raise StopIteration raise StopIteration
except: except PropertiesOptionError:
pass # option with properties pass # option with properties
def iter_groups(self, group_type=None): def iter_groups(self, group_type=None):
@ -240,7 +240,7 @@ class SubConfig(object):
yield child._name, getattr(self, child._name) yield child._name, getattr(self, child._name)
except GeneratorExit: except GeneratorExit:
raise StopIteration raise StopIteration
except: except PropertiesOptionError:
pass pass
# ______________________________________________________________________ # ______________________________________________________________________
@ -252,7 +252,7 @@ class SubConfig(object):
for name, value in self: for name, value in self:
try: try:
lines.append("%s = %s" % (name, value)) lines.append("%s = %s" % (name, value))
except: except PropertiesOptionError:
pass pass
return '\n'.join(lines) return '\n'.join(lines)
@ -425,8 +425,7 @@ class Config(SubConfig):
getattr(homeconfig, name) getattr(homeconfig, name)
except MandatoryError: except MandatoryError:
pass pass
except Exception, e: except PropertiesOptionError, e:
#FIXME hu? should have Exception ?
raise e # HiddenOptionError or DisabledOptionError raise e # HiddenOptionError or DisabledOptionError
child = getattr(homeconfig._cfgimpl_descr, name) child = getattr(homeconfig._cfgimpl_descr, name)
homeconfig.setoption(name, child, value) homeconfig.setoption(name, child, value)
@ -464,7 +463,7 @@ class Config(SubConfig):
value = getattr(self, path) value = getattr(self, path)
if value == byvalue: if value == byvalue:
return True return True
except: # a property restricts the access of the value except PropertiesOptionError: # a property restricts the access of the value
pass pass
return False return False
@ -504,7 +503,7 @@ class Config(SubConfig):
#remove option with propertyerror, ... #remove option with propertyerror, ...
try: try:
value = getattr(self, path) value = getattr(self, path)
except: # a property restricts the access of the value except PropertiesOptionError: # a property restricts the access of the value
continue continue
if not _filter_by_type(): if not _filter_by_type():
continue continue

View file

@ -108,7 +108,7 @@ class Values(object):
return Multi(_result, self.context, opt) # , multitype) return Multi(_result, self.context, opt) # , multitype)
def _getcallback_value(self, opt): def _getcallback_value(self, opt):
callback, callback_params = opt.callback callback, callback_params = opt._callback
if callback_params is None: if callback_params is None:
callback_params = {} callback_params = {}
return carry_out_calculation(opt._name, config=self.context, return carry_out_calculation(opt._name, config=self.context,