fix initwrite behaviour

with handlers, a parameter from the cfg file which is not the
first of parameters with the same handler were not written.
fix: write_<param> method is called for all parameters in
<module>.writeDict even if there is no poll entry.

with this fix, when a parameter has the property initwrite=True,
the write_<param> method is called even when <param>
is not polled and even when <module>.pollerClass is None

Change-Id: I9b397deb5b20709fc4fa7c860c85b251a204c7f6
This commit is contained in:
2020-09-25 12:05:16 +02:00
parent 7af4d572ab
commit 3043200012
4 changed files with 38 additions and 35 deletions

View File

@ -115,7 +115,8 @@ class Parameter(Accessible):
settable=False, default=False),
'handler': Property('[internal] overload the standard read and write functions',
ValueType(), export=False, default=None, mandatory=False, settable=False),
'initwrite': Property('[internal] write this parameter on initialization (default None: write if given in config)',
'initwrite': Property('[internal] write this parameter on initialization'
' (default None: write if given in config)',
NoneOr(BoolType()), export=False, default=None, mandatory=False, settable=False),
}
@ -139,11 +140,8 @@ class Parameter(Accessible):
datatype.setProperty('unit', unit)
super(Parameter, self).__init__(**kwds)
if self.initwrite:
if self.readonly:
raise ProgrammingError('can not have both readonly and initwrite!')
if not self.poll:
raise ProgrammingError('only polled parameters can have initwrite!')
if self.initwrite and self.readonly:
raise ProgrammingError('can not have both readonly and initwrite!')
if self.constant is not None:
self.properties['readonly'] = True