ui: guard against typeerror when setting the value of a control box
This commit is contained in:
parent
e297f90e79
commit
7d4f787344
|
|
@ -715,7 +715,10 @@ def _update_setting_item(sbox, value, is_online=True, sensitive=True, null_okay=
|
||||||
return
|
return
|
||||||
sbox._failed.set_visible(False)
|
sbox._failed.set_visible(False)
|
||||||
sbox._control.set_sensitive(False)
|
sbox._control.set_sensitive(False)
|
||||||
sbox._control.set_value(value)
|
try: # a call was producing a TypeError so guard against that
|
||||||
|
sbox._control.set_value(value)
|
||||||
|
except TypeError as e:
|
||||||
|
logger.warning("%s: error setting control value (%s): %s", sbox.setting.name, sbox.setting._device, repr(e))
|
||||||
sbox._control.set_sensitive(sensitive is True)
|
sbox._control.set_sensitive(sensitive is True)
|
||||||
_change_icon(sensitive, sbox._change_icon)
|
_change_icon(sensitive, sbox._change_icon)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,8 @@ def test_simple_template(test, mocker, mock_gethostname):
|
||||||
assert setting.choices == test.choices
|
assert setting.choices == test.choices
|
||||||
|
|
||||||
value = setting.read(cached=False)
|
value = setting.read(cached=False)
|
||||||
assert value == tst.initial_value
|
unreadable = hasattr(setting._rw, "read_fnid") and setting._rw.read_fnid is None
|
||||||
|
assert value == (tst.initial_value if not unreadable else None)
|
||||||
|
|
||||||
cached_value = setting.read(cached=True)
|
cached_value = setting.read(cached=True)
|
||||||
assert cached_value == tst.initial_value
|
assert cached_value == tst.initial_value
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue