Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5cdc614

Browse files
Remove unnecessary delayed processing of value
Previously we did this as we wanted to spot the case where no value was provided, either during record creation or by a set() call at some later time, so that we could mark the record as being in an invalid state. Now that we store the severity and status alongside the value, we don't need to handle this special case.
1 parent d351bae commit 5cdc614

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

softioc/device.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def __init__(self, name, **kargs):
180180
initial_severity = alarm.NO_ALARM
181181
initial_status = alarm.NO_ALARM
182182
else:
183-
value = None
183+
value = self._default_value()
184184
# To maintain backwards compatibility, if there is no initial value
185185
# we mark the record as invalid
186186
initial_severity = alarm.INVALID_ALARM
@@ -198,11 +198,6 @@ def init_record(self, record):
198198
'''Special record initialisation for out records only: implements
199199
special record initialisation if an initial value has been specified,
200200
allowing out records to have a sensible initial value.'''
201-
if self._value[0] is None:
202-
# Cannot set in __init__ (like we do for In records), as we want
203-
# the record alarm status to be set if no value was provided
204-
value = self._default_value()
205-
self._value = (value, self._value[1], self._value[2])
206201

207202
self._write_value(record, self._value[0])
208203
if 'MLST' in self._fields_:

0 commit comments

Comments
 (0)