Allow config value transformers to give up

This commit is contained in:
Florian Bruhin 2016-08-16 18:38:45 +02:00
parent 9c3807c117
commit c033ed9edb

View File

@ -525,7 +525,15 @@ class ConfigManager(QObject):
k = self.RENAMED_OPTIONS[sectname, k] k = self.RENAMED_OPTIONS[sectname, k]
if (sectname, k) in self.CHANGED_OPTIONS: if (sectname, k) in self.CHANGED_OPTIONS:
func = self.CHANGED_OPTIONS[(sectname, k)] func = self.CHANGED_OPTIONS[(sectname, k)]
v = func(v) new_v = func(v)
if new_v is None:
exc = configexc.ValidationError(
v, "Could not automatically migrate the given value")
exc.section = sectname
exc.option = k
raise exc
v = new_v
try: try:
self.set('conf', sectname, k, v, validate=False) self.set('conf', sectname, k, v, validate=False)