Make dump_userconfig work
This commit is contained in:
parent
a0a8f5d025
commit
763276a65f
@ -240,8 +240,18 @@ class Config:
|
||||
The changed config part as string.
|
||||
|
||||
"""
|
||||
# FIXME to be implemented
|
||||
pass
|
||||
lines = []
|
||||
for secname, section in self.config.items():
|
||||
changed_opts = []
|
||||
for optname, option in section.items():
|
||||
if (option.rawvalue is not None and
|
||||
option.rawvalue != option.default):
|
||||
keyval = '{} = {}'.format(optname, option)
|
||||
changed_opts.append(keyval)
|
||||
if changed_opts:
|
||||
lines.append('[{}]'.format(secname))
|
||||
lines += changed_opts
|
||||
return '\n'.join(lines)
|
||||
|
||||
def optionxform(self, val):
|
||||
"""Implemented to be compatible with ConfigParser interpolation."""
|
||||
|
@ -79,7 +79,7 @@ class SettingValue:
|
||||
|
||||
"""
|
||||
self.typ = typ()
|
||||
self._rawvalue = None
|
||||
self.rawvalue = None
|
||||
self.default = default
|
||||
|
||||
def __str__(self):
|
||||
@ -94,12 +94,12 @@ class SettingValue:
|
||||
@property
|
||||
def value(self):
|
||||
"""Get the currently valid value."""
|
||||
return self._rawvalue if self._rawvalue is not None else self.default
|
||||
return self.rawvalue if self.rawvalue is not None else self.default
|
||||
|
||||
@value.setter
|
||||
def value(self, val):
|
||||
"""Set the currently valid value."""
|
||||
self._rawvalue = val
|
||||
self.rawvalue = val
|
||||
|
||||
|
||||
class BaseType:
|
||||
|
Loading…
Reference in New Issue
Block a user