string representation for a symlink option

This commit is contained in:
gwen 2012-11-29 10:15:30 +01:00
parent d9c8e06236
commit de47772958
2 changed files with 8 additions and 2 deletions

View File

@ -176,7 +176,8 @@ class Config(object):
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:
return getattr(self, opt_or_descr.path) rootconfig = self._cfgimpl_get_toplevel()
return getattr(rootconfig, opt_or_descr.path)
if name not in self._cfgimpl_values: if name not in self._cfgimpl_values:
raise AttributeError("%s object has no attribute %s" % raise AttributeError("%s object has no attribute %s" %
(self.__class__, name)) (self.__class__, name))
@ -384,7 +385,7 @@ class Config(object):
"""Pythonesque way of parsing group's ordered options. """Pythonesque way of parsing group's ordered options.
iteration only on Options (not OptionDescriptions)""" iteration only on Options (not OptionDescriptions)"""
for child in self._cfgimpl_descr._children: for child in self._cfgimpl_descr._children:
if isinstance(child, Option): if not isinstance(child, OptionDescription):
try: try:
yield child._name, getattr(self, child._name) yield child._name, getattr(self, child._name)
except: except:

View File

@ -326,6 +326,11 @@ class ChoiceOption(Option):
requires=None, mandatory=False, multi=False, callback=None, requires=None, mandatory=False, multi=False, callback=None,
callback_params=None, open_values=False, validator=None, callback_params=None, open_values=False, validator=None,
validator_args={}): validator_args={}):
"""
:default: default non multi option's value
:default_multi: default value in case of a multi
:param open_values: allowed values for the option's value
"""
self.values = values self.values = values
if open_values not in [True, False]: if open_values not in [True, False]:
raise ConfigError('Open_values must be a boolean for ' raise ConfigError('Open_values must be a boolean for '