treat return value of write_<par> correctly

if the return value is 0 or "", and value is different from it,
then the behaviour is incorrect.
Alternative: we do not allow write_<par> to return None, and
check for it, or even validate the returned value.

Change-Id: If7381dd06f7c55bdc4a80981e67f831cd8ee4136
Reviewed-on: https://forge.frm2.tum.de/review/19728
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
zolliker 2019-01-11 14:49:38 +01:00 committed by Enrico Faulhaber
parent 09507f83f1
commit 1c33a41748

View File

@ -170,7 +170,9 @@ class ModuleMeta(type):
value = pobj.datatype.validate(value)
if wfunc:
self.log.debug('calling %r(%r)' % (wfunc, value))
value = wfunc(self, value) or value
returned_value = wfunc(self, value)
if returned_value is not None:
value = returned_value
# XXX: use setattr or direct manipulation
# of self.accessibles[pname]?
setattr(self, pname, value)