More config bugfixes

This commit is contained in:
Florian Bruhin 2014-04-02 16:47:21 +02:00
parent 89e21499c8
commit 45ffa9dece
2 changed files with 7 additions and 10 deletions

View File

@ -149,9 +149,7 @@ class Config:
else:
lines += wrapper.wrap('Valid values: {}'.format(', '.join(
valid_values)))
lines += wrapper.wrap('Default: {}'.format(
option.default_conf if option.default_conf is not None
else option.default))
lines += wrapper.wrap('Default: {}'.format(option.default))
return lines
def _str_items(self, section):
@ -170,7 +168,7 @@ class Config:
section: The section to get the option from.
option: The option name
fallback: A fallback value.
raw: Whether to get the uninterpolated (but transformed!) value.
raw: Whether to get the uninterpolated, untransformed value.
"""
logging.debug("getting {} -> {}".format(section, option))
@ -183,7 +181,7 @@ class Config:
return fallback
else:
if raw:
return val.transformed()
return val
newval = self._interpolation.before_get(
self, section, option, val.value,
self.config[section].values)

View File

@ -109,19 +109,18 @@ class ValueList:
Attributes:
values: An OrderedDict with key as index and value as value.
default: An OrderedDict with the default configuration as strings.
After __init__, the strings become key/value types.
types: A tuple for (keytype, valuetype)
valdict: The "true value" dict.
descriptions: A dict with the description strings for the keys.
Currently a global empty dict to be compatible with
KeyValue section.
#descriptions: A dict with the description strings for the keys.
# Currently a global empty dict to be compatible with
# KeyValue section.
"""
values = None
default = None
types = None
descriptions = {}
#descriptions = {}
def __init__(self):
"""Wrap types over default values. Take care when overriding this."""